This commit is contained in:
Dominic Wong
2021-09-21 20:15:36 +01:00
parent 209283bcb7
commit a423dd9e99
3 changed files with 4 additions and 6 deletions

View File

@@ -20,6 +20,7 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
) )
// Get the list of countries that are supported by this API
type CountriesRequest struct { type CountriesRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@@ -162,6 +163,7 @@ func (x *Country) GetName() string {
return "" return ""
} }
// List the holiday dates for a given country and year
type ListRequest struct { type ListRequest struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache

View File

@@ -42,9 +42,7 @@ func NewHolidaysEndpoints() []*api.Endpoint {
// Client API for Holidays service // Client API for Holidays service
type HolidaysService interface { type HolidaysService interface {
// Get the list of countries that are supported by this API
Countries(ctx context.Context, in *CountriesRequest, opts ...client.CallOption) (*CountriesResponse, error) Countries(ctx context.Context, in *CountriesRequest, opts ...client.CallOption) (*CountriesResponse, error)
// List the holiday dates for a given country and year
List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error) List(ctx context.Context, in *ListRequest, opts ...client.CallOption) (*ListResponse, error)
} }
@@ -83,9 +81,7 @@ func (c *holidaysService) List(ctx context.Context, in *ListRequest, opts ...cli
// Server API for Holidays service // Server API for Holidays service
type HolidaysHandler interface { type HolidaysHandler interface {
// Get the list of countries that are supported by this API
Countries(context.Context, *CountriesRequest, *CountriesResponse) error Countries(context.Context, *CountriesRequest, *CountriesResponse) error
// List the holiday dates for a given country and year
List(context.Context, *ListRequest, *ListResponse) error List(context.Context, *ListRequest, *ListResponse) error
} }

View File

@@ -5,12 +5,11 @@ package holidays;
option go_package = "./proto;holidays"; option go_package = "./proto;holidays";
service Holidays { service Holidays {
// Get the list of countries that are supported by this API
rpc Countries(CountriesRequest) returns (CountriesResponse) {} rpc Countries(CountriesRequest) returns (CountriesResponse) {}
// List the holiday dates for a given country and year
rpc List(ListRequest) returns (ListResponse) {} rpc List(ListRequest) returns (ListResponse) {}
} }
// Get the list of countries that are supported by this API
message CountriesRequest { message CountriesRequest {
} }
@@ -25,6 +24,7 @@ message Country {
string name = 2; string name = 2;
} }
// List the holiday dates for a given country and year
message ListRequest { message ListRequest {
// The 2 letter country code (as defined in ISO 3166-1 alpha-2) // The 2 letter country code (as defined in ISO 3166-1 alpha-2)
string country_code = 1; string country_code = 1;