diff --git a/.github/workflows/testing.yaml b/.github/workflows/testing.yaml index 6c8ca70..c38a2db 100644 --- a/.github/workflows/testing.yaml +++ b/.github/workflows/testing.yaml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v3 with: - go-version: 1.20.4 + go-version: 1.21.0 - name: Install Protoc uses: arduino/setup-protoc@v1 diff --git a/README.md b/README.md index 5b69e75..a4003f8 100644 --- a/README.md +++ b/README.md @@ -304,6 +304,7 @@ func main() { subData := subscription.Data{ Description: "my subscription", Enabled: true, + Expires: time.Now().Add(24 * time.Hour), // optional, subscription will be treated as disabled after it expires Condition: condition.NewBuilder(). AttributeKey("tags"). AnyOfWords("SpaceX"). diff --git a/api/client_test.go b/api/client_test.go index 3b348e2..03415bd 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -391,6 +391,7 @@ func TestClient_CreateSubscription(t *testing.T) { ctx := context.TODO() subData := subscription.Data{ Description: c.descr, + Expires: time.Now(), } id, err := cl.CreateSubscription(ctx, "user0", subData) assert.Equal(t, c.id, id) @@ -413,6 +414,7 @@ func TestClient_ReadSubscription(t *testing.T) { subData: subscription.Data{ Description: "my subscription", Enabled: true, + Expires: time.Date(2023, 10, 4, 11, 44, 55, 0, time.UTC), Condition: condition. NewBuilder(). Any([]condition.Condition{ @@ -496,7 +498,9 @@ func TestClient_UpdateSubscriptionMetadata(t *testing.T) { svcSubs: c.svcSubs, } ctx := context.TODO() - err := cl.UpdateSubscription(ctx, "user0", c.subId, subscription.Data{}) + err := cl.UpdateSubscription(ctx, "user0", c.subId, subscription.Data{ + Expires: time.Now(), + }) assert.ErrorIs(t, err, c.err) assert.Nil(t, cl.Close()) }) diff --git a/api/grpc/subscriptions/client_mock.go b/api/grpc/subscriptions/client_mock.go index d9dd4ef..1aa70ba 100644 --- a/api/grpc/subscriptions/client_mock.go +++ b/api/grpc/subscriptions/client_mock.go @@ -5,6 +5,8 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" + "time" ) type clientMock struct{} @@ -44,6 +46,7 @@ func (cm clientMock) Read(ctx context.Context, req *ReadRequest, opts ...grpc.Ca default: resp.Description = "subscription" resp.Enabled = true + resp.Expires = timestamppb.New(time.Date(2023, 10, 4, 11, 44, 55, 0, time.UTC)) resp.Cond = &Condition{ Cond: &Condition_Gc{ Gc: &GroupCondition{ diff --git a/api/grpc/subscriptions/service.go b/api/grpc/subscriptions/service.go index 5c78224..86fb967 100644 --- a/api/grpc/subscriptions/service.go +++ b/api/grpc/subscriptions/service.go @@ -10,6 +10,7 @@ import ( "github.com/awakari/client-sdk-go/model/subscription/condition" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" ) type Service interface { @@ -59,6 +60,7 @@ func (svc service) Create(ctx context.Context, userId string, subData subscripti Cond: encodeCondition(subData.Condition), Description: subData.Description, Enabled: subData.Enabled, + Expires: timestamppb.New(subData.Expires.UTC()), } var resp *CreateResponse resp, err = svc.client.Create(ctx, &req) @@ -81,6 +83,9 @@ func (svc service) Read(ctx context.Context, userId, subId string) (subData subs subData.Condition, err = decodeCondition(resp.Cond) subData.Description = resp.Description subData.Enabled = resp.Enabled + if resp.Expires != nil { + subData.Expires = resp.Expires.AsTime() + } } return } @@ -91,6 +96,7 @@ func (svc service) Update(ctx context.Context, userId, subId string, data subscr Id: subId, Description: data.Description, Enabled: data.Enabled, + Expires: timestamppb.New(data.Expires.UTC()), } _, err = svc.client.Update(ctx, &req) err = decodeError(err) diff --git a/api/grpc/subscriptions/service.pb.go b/api/grpc/subscriptions/service.pb.go index ae9765f..4570d52 100644 --- a/api/grpc/subscriptions/service.pb.go +++ b/api/grpc/subscriptions/service.pb.go @@ -13,6 +13,7 @@ import ( status "google.golang.org/grpc/status" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" reflect "reflect" sync "sync" ) @@ -136,9 +137,10 @@ type CreateRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` - Cond *Condition `protobuf:"bytes,3,opt,name=cond,proto3" json:"cond,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + Cond *Condition `protobuf:"bytes,3,opt,name=cond,proto3" json:"cond,omitempty"` + Expires *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires,proto3" json:"expires,omitempty"` } func (x *CreateRequest) Reset() { @@ -194,6 +196,13 @@ func (x *CreateRequest) GetCond() *Condition { return nil } +func (x *CreateRequest) GetExpires() *timestamppb.Timestamp { + if x != nil { + return x.Expires + } + return nil +} + // Condition represents the Subscription routing Condition data that is immutable once Subscription is created. type Condition struct { state protoimpl.MessageState @@ -594,9 +603,10 @@ type ReadResponse struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` - Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` - Cond *Condition `protobuf:"bytes,3,opt,name=cond,proto3" json:"cond,omitempty"` + Description string `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + Enabled bool `protobuf:"varint,2,opt,name=enabled,proto3" json:"enabled,omitempty"` + Cond *Condition `protobuf:"bytes,3,opt,name=cond,proto3" json:"cond,omitempty"` + Expires *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires,proto3" json:"expires,omitempty"` } func (x *ReadResponse) Reset() { @@ -652,14 +662,22 @@ func (x *ReadResponse) GetCond() *Condition { return nil } +func (x *ReadResponse) GetExpires() *timestamppb.Timestamp { + if x != nil { + return x.Expires + } + return nil +} + type UpdateRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + Enabled bool `protobuf:"varint,3,opt,name=enabled,proto3" json:"enabled,omitempty"` + Expires *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expires,proto3" json:"expires,omitempty"` } func (x *UpdateRequest) Reset() { @@ -715,6 +733,13 @@ func (x *UpdateRequest) GetEnabled() bool { return false } +func (x *UpdateRequest) GetExpires() *timestamppb.Timestamp { + if x != nil { + return x.Expires + } + return nil +} + type UpdateResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -947,123 +972,135 @@ var file_api_grpc_subscriptions_service_proto_rawDesc = []byte{ 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1b, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x78, 0x79, 0x22, 0x87, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, - 0x64, 0x12, 0x3a, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x6f, - 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x22, 0xe2, 0x01, - 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6e, - 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x03, 0x6e, 0x6f, 0x74, 0x12, 0x3d, 0x0a, - 0x02, 0x67, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, - 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, - 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x02, 0x67, 0x63, 0x12, 0x3c, 0x0a, 0x02, - 0x74, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, - 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x54, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x02, 0x74, 0x63, 0x12, 0x3e, 0x0a, 0x02, 0x6e, 0x63, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, - 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, - 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x02, 0x6e, 0x63, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x6f, - 0x6e, 0x64, 0x22, 0x8d, 0x01, 0x0a, 0x0e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, 0x64, - 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x52, 0x05, 0x6c, - 0x6f, 0x67, 0x69, 0x63, 0x12, 0x3c, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x67, 0x72, 0x6f, - 0x75, 0x70, 0x22, 0x5b, 0x0a, 0x0d, 0x54, 0x65, 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x61, - 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x22, - 0x7d, 0x0a, 0x0f, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x6b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x02, 0x6f, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, + 0x6f, 0x78, 0x79, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xbd, 0x01, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x12, 0x3a, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x02, 0x6f, 0x70, 0x12, 0x10, 0x0a, 0x03, - 0x76, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x20, - 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x1d, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, - 0x86, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x3a, 0x0a, 0x04, - 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, + 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x12, 0x34, + 0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, + 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x78, 0x70, + 0x69, 0x72, 0x65, 0x73, 0x22, 0xe2, 0x01, 0x0a, 0x09, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x6f, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x03, 0x6e, 0x6f, 0x74, 0x12, 0x3d, 0x0a, 0x02, 0x67, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, + 0x72, 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, + 0x02, 0x67, 0x63, 0x12, 0x3c, 0x0a, 0x02, 0x74, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x2a, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x54, 0x65, + 0x78, 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x02, 0x74, + 0x63, 0x12, 0x3e, 0x0a, 0x02, 0x6e, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2c, 0x2e, + 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52, 0x02, 0x6e, + 0x63, 0x42, 0x06, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x22, 0x8d, 0x01, 0x0a, 0x0e, 0x47, 0x72, + 0x6f, 0x75, 0x70, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x3d, 0x0a, 0x05, + 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x61, 0x77, + 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, + 0x6f, 0x67, 0x69, 0x63, 0x52, 0x05, 0x6c, 0x6f, 0x67, 0x69, 0x63, 0x12, 0x3c, 0x0a, 0x05, 0x67, + 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x22, 0x5b, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, - 0x61, 0x62, 0x6c, 0x65, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x44, 0x65, 0x6c, 0x65, 0x74, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x10, 0x0a, 0x0e, 0x44, 0x65, 0x6c, 0x65, - 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x0a, 0x10, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, - 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x25, 0x0a, 0x11, - 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, - 0x69, 0x64, 0x73, 0x2a, 0x26, 0x0a, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4c, 0x6f, 0x67, 0x69, - 0x63, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x64, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x72, - 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x58, 0x6f, 0x72, 0x10, 0x02, 0x2a, 0x44, 0x0a, 0x09, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, 0x55, 0x6e, 0x64, 0x65, - 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x47, 0x74, 0x10, 0x01, 0x12, - 0x07, 0x0a, 0x03, 0x47, 0x74, 0x65, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, 0x45, 0x71, 0x10, 0x03, - 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x74, 0x65, 0x10, 0x04, 0x12, 0x06, 0x0a, 0x02, 0x4c, 0x74, 0x10, - 0x05, 0x32, 0xfb, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x61, 0x0a, - 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, + 0x6f, 0x6e, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x22, 0x5b, 0x0a, 0x0d, 0x54, 0x65, 0x78, + 0x74, 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x65, 0x72, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x72, 0x6d, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x65, 0x78, 0x61, 0x63, 0x74, 0x22, 0x7d, 0x0a, 0x0f, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x36, 0x0a, 0x02, 0x6f, + 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x5b, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x28, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, - 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, - 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, - 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x02, 0x6f, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x01, + 0x52, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x20, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1d, 0x0a, 0x0b, 0x52, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0xbc, 0x01, 0x0a, 0x0c, 0x52, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x12, 0x3a, 0x0a, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x26, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, + 0x43, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x63, 0x6f, 0x6e, 0x64, 0x12, + 0x34, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, + 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x07, 0x65, 0x78, + 0x70, 0x69, 0x72, 0x65, 0x73, 0x22, 0x91, 0x01, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, + 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, + 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, + 0x62, 0x6c, 0x65, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x12, 0x34, 0x0a, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x52, 0x07, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x0a, 0x0d, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x10, 0x0a, 0x0e, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, + 0x0a, 0x10, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x63, 0x75, 0x72, 0x73, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x22, 0x25, 0x0a, 0x11, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x03, 0x69, 0x64, 0x73, 0x2a, 0x26, 0x0a, 0x0a, 0x47, 0x72, 0x6f, 0x75, 0x70, + 0x4c, 0x6f, 0x67, 0x69, 0x63, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x6e, 0x64, 0x10, 0x00, 0x12, 0x06, + 0x0a, 0x02, 0x4f, 0x72, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x58, 0x6f, 0x72, 0x10, 0x02, 0x2a, + 0x44, 0x0a, 0x09, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0d, 0x0a, 0x09, + 0x55, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x47, + 0x74, 0x10, 0x01, 0x12, 0x07, 0x0a, 0x03, 0x47, 0x74, 0x65, 0x10, 0x02, 0x12, 0x06, 0x0a, 0x02, + 0x45, 0x71, 0x10, 0x03, 0x12, 0x07, 0x0a, 0x03, 0x4c, 0x74, 0x65, 0x10, 0x04, 0x12, 0x06, 0x0a, + 0x02, 0x4c, 0x74, 0x10, 0x05, 0x32, 0xfb, 0x03, 0x0a, 0x07, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x61, 0x0a, 0x06, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x61, 0x77, + 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, - 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, - 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x61, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x61, 0x77, 0x61, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x28, 0x2e, 0x61, + 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, + 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x61, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x2a, 0x2e, 0x61, 0x77, + 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, + 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, + 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x61, 0x0a, 0x06, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x12, 0x2a, + 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, - 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, - 0x12, 0x2d, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x53, - 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x2e, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x2e, 0x53, 0x65, - 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x2f, 0x73, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6a, 0x0a, 0x09, 0x53, 0x65, 0x61, 0x72, 0x63, + 0x68, 0x4f, 0x77, 0x6e, 0x12, 0x2d, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, + 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x78, 0x79, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x61, 0x77, 0x61, 0x6b, 0x61, 0x72, 0x69, 0x2e, 0x73, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x78, + 0x79, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x4f, 0x77, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x42, 0x1a, 0x5a, 0x18, 0x2e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x72, 0x70, + 0x63, 0x2f, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1081,47 +1118,51 @@ func file_api_grpc_subscriptions_service_proto_rawDescGZIP() []byte { var file_api_grpc_subscriptions_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_api_grpc_subscriptions_service_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_api_grpc_subscriptions_service_proto_goTypes = []interface{}{ - (GroupLogic)(0), // 0: awakari.subscriptions.proxy.GroupLogic - (Operation)(0), // 1: awakari.subscriptions.proxy.Operation - (*CreateRequest)(nil), // 2: awakari.subscriptions.proxy.CreateRequest - (*Condition)(nil), // 3: awakari.subscriptions.proxy.Condition - (*GroupCondition)(nil), // 4: awakari.subscriptions.proxy.GroupCondition - (*TextCondition)(nil), // 5: awakari.subscriptions.proxy.TextCondition - (*NumberCondition)(nil), // 6: awakari.subscriptions.proxy.NumberCondition - (*CreateResponse)(nil), // 7: awakari.subscriptions.proxy.CreateResponse - (*ReadRequest)(nil), // 8: awakari.subscriptions.proxy.ReadRequest - (*ReadResponse)(nil), // 9: awakari.subscriptions.proxy.ReadResponse - (*UpdateRequest)(nil), // 10: awakari.subscriptions.proxy.UpdateRequest - (*UpdateResponse)(nil), // 11: awakari.subscriptions.proxy.UpdateResponse - (*DeleteRequest)(nil), // 12: awakari.subscriptions.proxy.DeleteRequest - (*DeleteResponse)(nil), // 13: awakari.subscriptions.proxy.DeleteResponse - (*SearchOwnRequest)(nil), // 14: awakari.subscriptions.proxy.SearchOwnRequest - (*SearchOwnResponse)(nil), // 15: awakari.subscriptions.proxy.SearchOwnResponse + (GroupLogic)(0), // 0: awakari.subscriptions.proxy.GroupLogic + (Operation)(0), // 1: awakari.subscriptions.proxy.Operation + (*CreateRequest)(nil), // 2: awakari.subscriptions.proxy.CreateRequest + (*Condition)(nil), // 3: awakari.subscriptions.proxy.Condition + (*GroupCondition)(nil), // 4: awakari.subscriptions.proxy.GroupCondition + (*TextCondition)(nil), // 5: awakari.subscriptions.proxy.TextCondition + (*NumberCondition)(nil), // 6: awakari.subscriptions.proxy.NumberCondition + (*CreateResponse)(nil), // 7: awakari.subscriptions.proxy.CreateResponse + (*ReadRequest)(nil), // 8: awakari.subscriptions.proxy.ReadRequest + (*ReadResponse)(nil), // 9: awakari.subscriptions.proxy.ReadResponse + (*UpdateRequest)(nil), // 10: awakari.subscriptions.proxy.UpdateRequest + (*UpdateResponse)(nil), // 11: awakari.subscriptions.proxy.UpdateResponse + (*DeleteRequest)(nil), // 12: awakari.subscriptions.proxy.DeleteRequest + (*DeleteResponse)(nil), // 13: awakari.subscriptions.proxy.DeleteResponse + (*SearchOwnRequest)(nil), // 14: awakari.subscriptions.proxy.SearchOwnRequest + (*SearchOwnResponse)(nil), // 15: awakari.subscriptions.proxy.SearchOwnResponse + (*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp } var file_api_grpc_subscriptions_service_proto_depIdxs = []int32{ 3, // 0: awakari.subscriptions.proxy.CreateRequest.cond:type_name -> awakari.subscriptions.proxy.Condition - 4, // 1: awakari.subscriptions.proxy.Condition.gc:type_name -> awakari.subscriptions.proxy.GroupCondition - 5, // 2: awakari.subscriptions.proxy.Condition.tc:type_name -> awakari.subscriptions.proxy.TextCondition - 6, // 3: awakari.subscriptions.proxy.Condition.nc:type_name -> awakari.subscriptions.proxy.NumberCondition - 0, // 4: awakari.subscriptions.proxy.GroupCondition.logic:type_name -> awakari.subscriptions.proxy.GroupLogic - 3, // 5: awakari.subscriptions.proxy.GroupCondition.group:type_name -> awakari.subscriptions.proxy.Condition - 1, // 6: awakari.subscriptions.proxy.NumberCondition.op:type_name -> awakari.subscriptions.proxy.Operation - 3, // 7: awakari.subscriptions.proxy.ReadResponse.cond:type_name -> awakari.subscriptions.proxy.Condition - 2, // 8: awakari.subscriptions.proxy.Service.Create:input_type -> awakari.subscriptions.proxy.CreateRequest - 8, // 9: awakari.subscriptions.proxy.Service.Read:input_type -> awakari.subscriptions.proxy.ReadRequest - 10, // 10: awakari.subscriptions.proxy.Service.Update:input_type -> awakari.subscriptions.proxy.UpdateRequest - 12, // 11: awakari.subscriptions.proxy.Service.Delete:input_type -> awakari.subscriptions.proxy.DeleteRequest - 14, // 12: awakari.subscriptions.proxy.Service.SearchOwn:input_type -> awakari.subscriptions.proxy.SearchOwnRequest - 7, // 13: awakari.subscriptions.proxy.Service.Create:output_type -> awakari.subscriptions.proxy.CreateResponse - 9, // 14: awakari.subscriptions.proxy.Service.Read:output_type -> awakari.subscriptions.proxy.ReadResponse - 11, // 15: awakari.subscriptions.proxy.Service.Update:output_type -> awakari.subscriptions.proxy.UpdateResponse - 13, // 16: awakari.subscriptions.proxy.Service.Delete:output_type -> awakari.subscriptions.proxy.DeleteResponse - 15, // 17: awakari.subscriptions.proxy.Service.SearchOwn:output_type -> awakari.subscriptions.proxy.SearchOwnResponse - 13, // [13:18] is the sub-list for method output_type - 8, // [8:13] is the sub-list for method input_type - 8, // [8:8] is the sub-list for extension type_name - 8, // [8:8] is the sub-list for extension extendee - 0, // [0:8] is the sub-list for field type_name + 16, // 1: awakari.subscriptions.proxy.CreateRequest.expires:type_name -> google.protobuf.Timestamp + 4, // 2: awakari.subscriptions.proxy.Condition.gc:type_name -> awakari.subscriptions.proxy.GroupCondition + 5, // 3: awakari.subscriptions.proxy.Condition.tc:type_name -> awakari.subscriptions.proxy.TextCondition + 6, // 4: awakari.subscriptions.proxy.Condition.nc:type_name -> awakari.subscriptions.proxy.NumberCondition + 0, // 5: awakari.subscriptions.proxy.GroupCondition.logic:type_name -> awakari.subscriptions.proxy.GroupLogic + 3, // 6: awakari.subscriptions.proxy.GroupCondition.group:type_name -> awakari.subscriptions.proxy.Condition + 1, // 7: awakari.subscriptions.proxy.NumberCondition.op:type_name -> awakari.subscriptions.proxy.Operation + 3, // 8: awakari.subscriptions.proxy.ReadResponse.cond:type_name -> awakari.subscriptions.proxy.Condition + 16, // 9: awakari.subscriptions.proxy.ReadResponse.expires:type_name -> google.protobuf.Timestamp + 16, // 10: awakari.subscriptions.proxy.UpdateRequest.expires:type_name -> google.protobuf.Timestamp + 2, // 11: awakari.subscriptions.proxy.Service.Create:input_type -> awakari.subscriptions.proxy.CreateRequest + 8, // 12: awakari.subscriptions.proxy.Service.Read:input_type -> awakari.subscriptions.proxy.ReadRequest + 10, // 13: awakari.subscriptions.proxy.Service.Update:input_type -> awakari.subscriptions.proxy.UpdateRequest + 12, // 14: awakari.subscriptions.proxy.Service.Delete:input_type -> awakari.subscriptions.proxy.DeleteRequest + 14, // 15: awakari.subscriptions.proxy.Service.SearchOwn:input_type -> awakari.subscriptions.proxy.SearchOwnRequest + 7, // 16: awakari.subscriptions.proxy.Service.Create:output_type -> awakari.subscriptions.proxy.CreateResponse + 9, // 17: awakari.subscriptions.proxy.Service.Read:output_type -> awakari.subscriptions.proxy.ReadResponse + 11, // 18: awakari.subscriptions.proxy.Service.Update:output_type -> awakari.subscriptions.proxy.UpdateResponse + 13, // 19: awakari.subscriptions.proxy.Service.Delete:output_type -> awakari.subscriptions.proxy.DeleteResponse + 15, // 20: awakari.subscriptions.proxy.Service.SearchOwn:output_type -> awakari.subscriptions.proxy.SearchOwnResponse + 16, // [16:21] is the sub-list for method output_type + 11, // [11:16] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name } func init() { file_api_grpc_subscriptions_service_proto_init() } diff --git a/api/grpc/subscriptions/service.proto b/api/grpc/subscriptions/service.proto index e3e5a1e..4b18285 100644 --- a/api/grpc/subscriptions/service.proto +++ b/api/grpc/subscriptions/service.proto @@ -3,6 +3,7 @@ syntax = "proto3"; package awakari.subscriptions.proxy; option go_package = "./api/grpc/subscriptions"; +import "google/protobuf/timestamp.proto"; service Service { @@ -19,6 +20,7 @@ message CreateRequest { string description = 1; bool enabled = 2; Condition cond = 3; + google.protobuf.Timestamp expires = 4; } // Condition represents the Subscription routing Condition data that is immutable once Subscription is created. @@ -79,6 +81,7 @@ message ReadResponse { string description = 1; bool enabled = 2; Condition cond = 3; + google.protobuf.Timestamp expires = 4; } // Update @@ -87,6 +90,7 @@ message UpdateRequest { string id = 1; string description = 2; bool enabled = 3; + google.protobuf.Timestamp expires = 4; } message UpdateResponse { diff --git a/api/grpc/subscriptions/service_mock.go b/api/grpc/subscriptions/service_mock.go index 9818aec..f41793d 100644 --- a/api/grpc/subscriptions/service_mock.go +++ b/api/grpc/subscriptions/service_mock.go @@ -6,6 +6,7 @@ import ( "github.com/awakari/client-sdk-go/api/grpc/limits" "github.com/awakari/client-sdk-go/model/subscription" "github.com/awakari/client-sdk-go/model/subscription/condition" + "time" ) type serviceMock struct { @@ -44,6 +45,7 @@ func (sm serviceMock) Read(ctx context.Context, userId, subId string) (subData s default: subData.Description = "my subscription" subData.Enabled = true + subData.Expires = time.Date(2023, 10, 4, 11, 44, 55, 0, time.UTC) subData.Condition = condition. NewBuilder(). Any([]condition.Condition{ diff --git a/api/grpc/subscriptions/service_test.go b/api/grpc/subscriptions/service_test.go index e756994..6ba2f15 100644 --- a/api/grpc/subscriptions/service_test.go +++ b/api/grpc/subscriptions/service_test.go @@ -96,6 +96,16 @@ func TestService_Create(t *testing.T) { }, err: limits.ErrReached, }, + "ok with expiration": { + req: subscription.Data{ + Description: "my subscription", + Expires: time.Now(), + Condition: condition.NewTextCondition( + condition.NewKeyCondition(condition.NewCondition(false), "key0"), + "ok", false, + ), + }, + }, } // for k, c := range cases { @@ -134,6 +144,7 @@ func TestService_Read(t *testing.T) { sd: subscription.Data{ Description: "subscription", Enabled: true, + Expires: time.Date(2023, 10, 4, 11, 44, 55, 0, time.UTC), Condition: condition. NewBuilder(). Any( @@ -165,6 +176,7 @@ func TestService_Read(t *testing.T) { assert.Nil(t, err) assert.Equal(t, c.sd.Description, sd.Description) assert.Equal(t, c.sd.Enabled, sd.Enabled) + assert.Equal(t, c.sd.Expires, sd.Expires) assert.True(t, conditionsDataEqual(c.sd.Condition, sd.Condition)) } else { assert.ErrorIs(t, err, c.err) @@ -191,6 +203,7 @@ func TestService_Update(t *testing.T) { sd: subscription.Data{ Description: "my subscription", Enabled: false, + Expires: time.Now(), }, }, "fail": { diff --git a/go.mod b/go.mod index 7d95285..ac47e77 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/awakari/client-sdk-go -go 1.20 +go 1.21 require ( github.com/cloudevents/sdk-go/binding/format/protobuf/v2 v2.14.0 diff --git a/model/subscription/data.go b/model/subscription/data.go index 5c5df57..f1add6e 100644 --- a/model/subscription/data.go +++ b/model/subscription/data.go @@ -1,6 +1,9 @@ package subscription -import "github.com/awakari/client-sdk-go/model/subscription/condition" +import ( + "github.com/awakari/client-sdk-go/model/subscription/condition" + "time" +) type Data struct { @@ -13,4 +16,7 @@ type Data struct { // Enabled defines whether subscription is active and may be used to deliver a message. Enabled bool + + // Expires defines a deadline when subscription becomes disabled regardless the Enabled value. + Expires time.Time }