From 701431476a1c4b0301c6c10588289d22ed42e532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Thu, 6 Feb 2020 15:19:13 +0100 Subject: [PATCH] Add ability to list entities to inventory --- backend/inventory/app/server.go | 16 +- backend/inventory/app/server_test.go | 32 + backend/inventory/go.mod | 3 - backend/inventory/storage/storage.go | 27 + backend/proto/inventory/v1/inventory.pb.go | 192 ++++- .../inventory/v1/inventory_grpc_web_pb.d.ts | 44 +- .../inventory/v1/inventory_grpc_web_pb.js | 240 ++++++ .../generated/inventory/v1/inventory_pb.d.ts | 92 ++- .../generated/inventory/v1/inventory_pb.js | 755 ++++++++++++++++-- proto/inventory/v1/inventory.proto | 9 + 10 files changed, 1317 insertions(+), 93 deletions(-) diff --git a/backend/inventory/app/server.go b/backend/inventory/app/server.go index 02b0b06f68..1d2f94a668 100644 --- a/backend/inventory/app/server.go +++ b/backend/inventory/app/server.go @@ -16,6 +16,20 @@ type Server struct { Storage *storage.Storage } +func (s *Server) ListEntities(ctx context.Context, req *pb.ListEntitiesRequest) (*pb.ListEntitiesReply, error) { + entities, err := s.Storage.ListEntities(req.UriPrefix) + if err != nil { + return nil, status.Error(codes.Internal, "could not list entities") + } + + result := make([]*pb.Entity, len(entities)) + for i, v := range entities { + result[i] = &pb.Entity{Uri: v} + } + + return &pb.ListEntitiesReply{Entities: result}, nil +} + func (s *Server) CreateEntity(ctx context.Context, req *pb.CreateEntityRequest) (*pb.CreateEntityReply, error) { err := s.Storage.CreateEntity(req.GetEntity().GetUri()) if err != nil { @@ -34,7 +48,7 @@ func (s *Server) GetEntity(ctx context.Context, req *pb.GetEntityRequest) (*pb.G for _, factName := range req.GetIncludeFacts() { value, err := s.Storage.GetFact(entityUri, factName) if err != nil { - return nil, status.Error(codes.Internal, fmt.Sprintf("could not get fact %v for %v" , factName, entityUri)) + return nil, status.Error(codes.Internal, fmt.Sprintf("could not get fact %v for %v", factName, entityUri)) } facts = append(facts, &pb.Fact{Name: factName, Value: value}) } diff --git a/backend/inventory/app/server_test.go b/backend/inventory/app/server_test.go index fd6311645e..3bd6e95dd9 100644 --- a/backend/inventory/app/server_test.go +++ b/backend/inventory/app/server_test.go @@ -13,6 +13,38 @@ import ( pb "github.com/spotify/backstage/proto/inventory/v1" ) +func TestServerListEntities(t *testing.T) { + testStorage := NewTestStorage() + defer testStorage.Close() + s := Server{Storage: testStorage.Storage} + + entity := &pb.Entity{Uri: "boss://test/test"} + + _, err := s.CreateEntity(context.Background(), &pb.CreateEntityRequest{Entity: entity}) + if err != nil { + t.Errorf("ServerTest(TestServerListEntities) could not create: %v", err) + } + + list, err := s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: ""}) + if err != nil { + t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err) + } + if len(list.GetEntities()) != 1 { + t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 1, len(list.GetEntities())) + } + if list.GetEntities()[0].GetUri() != "boss://test/test" { + t.Errorf("ServerTest(TestServerListEntities) expected uri %v, got %v", "boss://test/test", list.GetEntities()[0].GetUri()) + } + + list, err = s.ListEntities(context.Background(), &pb.ListEntitiesRequest{UriPrefix: "boss://test2"}) + if err != nil { + t.Errorf("ServerTest(TestServerListEntities) could not list: %v", err) + } + if len(list.GetEntities()) != 0 { + t.Errorf("ServerTest(TestServerListEntities) expected %v items, got %v", 0, len(list.GetEntities())) + } +} + func TestServerCreateEntity(t *testing.T) { testStorage := NewTestStorage() defer testStorage.Close() diff --git a/backend/inventory/go.mod b/backend/inventory/go.mod index 7a2e505cf6..a7148725b1 100644 --- a/backend/inventory/go.mod +++ b/backend/inventory/go.mod @@ -8,8 +8,5 @@ require ( github.com/golang/protobuf v1.3.3 github.com/spotify/backstage/proto v0.0.0-00010101000000-000000000000 go.etcd.io/bbolt v1.3.3 - golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect - golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect google.golang.org/grpc v1.27.0 - honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect ) diff --git a/backend/inventory/storage/storage.go b/backend/inventory/storage/storage.go index 17cd09f35f..8b88000fe6 100644 --- a/backend/inventory/storage/storage.go +++ b/backend/inventory/storage/storage.go @@ -3,6 +3,7 @@ package storage import ( "fmt" "os" + "strings" "go.etcd.io/bbolt" ) @@ -62,6 +63,7 @@ func (s *Storage) GetFact(entityUri, name string) (string, error) { value = string(b.Get([]byte(name))) return nil }) + if err != nil { return "", err } @@ -69,6 +71,31 @@ func (s *Storage) GetFact(entityUri, name string) (string, error) { return value, nil } +func (s *Storage) ListEntities(uriPrefix string) ([]string, error) { + entities := []string{} + err := s.db.View(func(tx *bbolt.Tx) error { + err := tx.ForEach(func(name []byte, b *bbolt.Bucket) error { + namestring := string(name) + if uriPrefix == "" || strings.HasPrefix(namestring, uriPrefix) { + entities = append(entities, namestring) + } + return nil + }) + + if err != nil { + return err + } + + return nil + }) + + if err != nil { + return nil, err + } + + return entities, nil +} + func (s *Storage) CreateEntity(entityUri string) error { return s.db.Update(func(tx *bbolt.Tx) error { _, err := tx.CreateBucketIfNotExists([]byte(entityUri)) diff --git a/backend/proto/inventory/v1/inventory.pb.go b/backend/proto/inventory/v1/inventory.pb.go index 151557d0a0..589ed3154f 100644 --- a/backend/proto/inventory/v1/inventory.pb.go +++ b/backend/proto/inventory/v1/inventory.pb.go @@ -24,6 +24,84 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +type ListEntitiesRequest struct { + UriPrefix string `protobuf:"bytes,1,opt,name=uriPrefix,proto3" json:"uriPrefix,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListEntitiesRequest) Reset() { *m = ListEntitiesRequest{} } +func (m *ListEntitiesRequest) String() string { return proto.CompactTextString(m) } +func (*ListEntitiesRequest) ProtoMessage() {} +func (*ListEntitiesRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{0} +} + +func (m *ListEntitiesRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListEntitiesRequest.Unmarshal(m, b) +} +func (m *ListEntitiesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListEntitiesRequest.Marshal(b, m, deterministic) +} +func (m *ListEntitiesRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListEntitiesRequest.Merge(m, src) +} +func (m *ListEntitiesRequest) XXX_Size() int { + return xxx_messageInfo_ListEntitiesRequest.Size(m) +} +func (m *ListEntitiesRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ListEntitiesRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ListEntitiesRequest proto.InternalMessageInfo + +func (m *ListEntitiesRequest) GetUriPrefix() string { + if m != nil { + return m.UriPrefix + } + return "" +} + +type ListEntitiesReply struct { + Entities []*Entity `protobuf:"bytes,1,rep,name=entities,proto3" json:"entities,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListEntitiesReply) Reset() { *m = ListEntitiesReply{} } +func (m *ListEntitiesReply) String() string { return proto.CompactTextString(m) } +func (*ListEntitiesReply) ProtoMessage() {} +func (*ListEntitiesReply) Descriptor() ([]byte, []int) { + return fileDescriptor_70be9028e322f9d8, []int{1} +} + +func (m *ListEntitiesReply) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListEntitiesReply.Unmarshal(m, b) +} +func (m *ListEntitiesReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListEntitiesReply.Marshal(b, m, deterministic) +} +func (m *ListEntitiesReply) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListEntitiesReply.Merge(m, src) +} +func (m *ListEntitiesReply) XXX_Size() int { + return xxx_messageInfo_ListEntitiesReply.Size(m) +} +func (m *ListEntitiesReply) XXX_DiscardUnknown() { + xxx_messageInfo_ListEntitiesReply.DiscardUnknown(m) +} + +var xxx_messageInfo_ListEntitiesReply proto.InternalMessageInfo + +func (m *ListEntitiesReply) GetEntities() []*Entity { + if m != nil { + return m.Entities + } + return nil +} + type GetEntityRequest struct { Entity *Entity `protobuf:"bytes,1,opt,name=entity,proto3" json:"entity,omitempty"` IncludeFacts []string `protobuf:"bytes,2,rep,name=include_facts,json=includeFacts,proto3" json:"include_facts,omitempty"` @@ -36,7 +114,7 @@ func (m *GetEntityRequest) Reset() { *m = GetEntityRequest{} } func (m *GetEntityRequest) String() string { return proto.CompactTextString(m) } func (*GetEntityRequest) ProtoMessage() {} func (*GetEntityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{0} + return fileDescriptor_70be9028e322f9d8, []int{2} } func (m *GetEntityRequest) XXX_Unmarshal(b []byte) error { @@ -83,7 +161,7 @@ func (m *GetEntityReply) Reset() { *m = GetEntityReply{} } func (m *GetEntityReply) String() string { return proto.CompactTextString(m) } func (*GetEntityReply) ProtoMessage() {} func (*GetEntityReply) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{1} + return fileDescriptor_70be9028e322f9d8, []int{3} } func (m *GetEntityReply) XXX_Unmarshal(b []byte) error { @@ -129,7 +207,7 @@ func (m *CreateEntityRequest) Reset() { *m = CreateEntityRequest{} } func (m *CreateEntityRequest) String() string { return proto.CompactTextString(m) } func (*CreateEntityRequest) ProtoMessage() {} func (*CreateEntityRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{2} + return fileDescriptor_70be9028e322f9d8, []int{4} } func (m *CreateEntityRequest) XXX_Unmarshal(b []byte) error { @@ -168,7 +246,7 @@ func (m *CreateEntityReply) Reset() { *m = CreateEntityReply{} } func (m *CreateEntityReply) String() string { return proto.CompactTextString(m) } func (*CreateEntityReply) ProtoMessage() {} func (*CreateEntityReply) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{3} + return fileDescriptor_70be9028e322f9d8, []int{5} } func (m *CreateEntityReply) XXX_Unmarshal(b []byte) error { @@ -209,7 +287,7 @@ func (m *SetFactRequest) Reset() { *m = SetFactRequest{} } func (m *SetFactRequest) String() string { return proto.CompactTextString(m) } func (*SetFactRequest) ProtoMessage() {} func (*SetFactRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{4} + return fileDescriptor_70be9028e322f9d8, []int{6} } func (m *SetFactRequest) XXX_Unmarshal(b []byte) error { @@ -262,7 +340,7 @@ func (m *SetFactReply) Reset() { *m = SetFactReply{} } func (m *SetFactReply) String() string { return proto.CompactTextString(m) } func (*SetFactReply) ProtoMessage() {} func (*SetFactReply) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{5} + return fileDescriptor_70be9028e322f9d8, []int{7} } func (m *SetFactReply) XXX_Unmarshal(b []byte) error { @@ -302,7 +380,7 @@ func (m *GetFactRequest) Reset() { *m = GetFactRequest{} } func (m *GetFactRequest) String() string { return proto.CompactTextString(m) } func (*GetFactRequest) ProtoMessage() {} func (*GetFactRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{6} + return fileDescriptor_70be9028e322f9d8, []int{8} } func (m *GetFactRequest) XXX_Unmarshal(b []byte) error { @@ -348,7 +426,7 @@ func (m *GetFactReply) Reset() { *m = GetFactReply{} } func (m *GetFactReply) String() string { return proto.CompactTextString(m) } func (*GetFactReply) ProtoMessage() {} func (*GetFactReply) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{7} + return fileDescriptor_70be9028e322f9d8, []int{9} } func (m *GetFactReply) XXX_Unmarshal(b []byte) error { @@ -387,7 +465,7 @@ func (m *Entity) Reset() { *m = Entity{} } func (m *Entity) String() string { return proto.CompactTextString(m) } func (*Entity) ProtoMessage() {} func (*Entity) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{8} + return fileDescriptor_70be9028e322f9d8, []int{10} } func (m *Entity) XXX_Unmarshal(b []byte) error { @@ -427,7 +505,7 @@ func (m *Fact) Reset() { *m = Fact{} } func (m *Fact) String() string { return proto.CompactTextString(m) } func (*Fact) ProtoMessage() {} func (*Fact) Descriptor() ([]byte, []int) { - return fileDescriptor_70be9028e322f9d8, []int{9} + return fileDescriptor_70be9028e322f9d8, []int{11} } func (m *Fact) XXX_Unmarshal(b []byte) error { @@ -463,6 +541,8 @@ func (m *Fact) GetValue() string { } func init() { + proto.RegisterType((*ListEntitiesRequest)(nil), "spotify.backstage.inventory.v1.ListEntitiesRequest") + proto.RegisterType((*ListEntitiesReply)(nil), "spotify.backstage.inventory.v1.ListEntitiesReply") proto.RegisterType((*GetEntityRequest)(nil), "spotify.backstage.inventory.v1.GetEntityRequest") proto.RegisterType((*GetEntityReply)(nil), "spotify.backstage.inventory.v1.GetEntityReply") proto.RegisterType((*CreateEntityRequest)(nil), "spotify.backstage.inventory.v1.CreateEntityRequest") @@ -478,32 +558,36 @@ func init() { func init() { proto.RegisterFile("inventory/v1/inventory.proto", fileDescriptor_70be9028e322f9d8) } var fileDescriptor_70be9028e322f9d8 = []byte{ - // 390 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x4f, 0xc2, 0x40, - 0x10, 0x4d, 0x29, 0x60, 0x3a, 0x7c, 0x04, 0x57, 0x0f, 0x4d, 0x43, 0x0c, 0x59, 0x8d, 0xe1, 0x60, - 0x0a, 0x85, 0x8b, 0xf1, 0xe0, 0x01, 0xa3, 0xd5, 0x6b, 0x09, 0x89, 0xf1, 0x62, 0x0a, 0x2e, 0xa4, - 0x11, 0x5a, 0x6c, 0xb7, 0x35, 0xfd, 0x0f, 0xfe, 0x2c, 0x7f, 0x98, 0xd9, 0xed, 0x5a, 0x8a, 0x21, - 0x16, 0x02, 0xb7, 0xdd, 0x99, 0x79, 0xf3, 0x5e, 0x5f, 0x5f, 0x0b, 0x4d, 0xc7, 0x8d, 0x88, 0x4b, - 0x3d, 0x3f, 0xee, 0x44, 0x46, 0x27, 0xbd, 0xe8, 0x4b, 0xdf, 0xa3, 0x1e, 0x3a, 0x0b, 0x96, 0x1e, - 0x75, 0xa6, 0xb1, 0x3e, 0xb6, 0x27, 0xef, 0x01, 0xb5, 0x67, 0x44, 0x5f, 0x8d, 0x44, 0x06, 0xfe, - 0x84, 0x86, 0x49, 0xe8, 0xbd, 0x4b, 0x1d, 0x1a, 0x5b, 0xe4, 0x23, 0x24, 0x01, 0x45, 0xb7, 0x50, - 0x26, 0xbc, 0xa0, 0x4a, 0x2d, 0xa9, 0x5d, 0xe9, 0x5d, 0xea, 0xff, 0x2f, 0xd1, 0x05, 0x5c, 0xa0, - 0xd0, 0x39, 0xd4, 0x1c, 0x77, 0x32, 0x0f, 0xdf, 0xc8, 0xeb, 0xd4, 0x9e, 0xd0, 0x40, 0x2d, 0xb4, - 0xe4, 0xb6, 0x62, 0x55, 0x45, 0xf1, 0x81, 0xd5, 0xf0, 0x97, 0x04, 0xf5, 0x0c, 0xf3, 0x72, 0x1e, - 0xef, 0xcd, 0x7b, 0x03, 0xa5, 0x15, 0x5f, 0xa5, 0x77, 0x91, 0x07, 0x67, 0x42, 0xac, 0x04, 0x82, - 0x47, 0x70, 0x72, 0xe7, 0x13, 0x9b, 0x92, 0x83, 0x5a, 0x81, 0x87, 0x70, 0xbc, 0xbe, 0xf6, 0x00, - 0xcf, 0x89, 0x9f, 0xa1, 0x3e, 0x24, 0x94, 0xab, 0x17, 0x32, 0x9b, 0xa0, 0x24, 0xbd, 0x91, 0xef, - 0xf0, 0xa5, 0x8a, 0xb5, 0x2a, 0x20, 0x04, 0x45, 0xd7, 0x5e, 0x10, 0xb5, 0xc0, 0x1b, 0xfc, 0x8c, - 0x4e, 0xa1, 0x14, 0xd9, 0xf3, 0x90, 0xa8, 0x32, 0x2f, 0x26, 0x17, 0xfc, 0x08, 0xd5, 0x74, 0x33, - 0x53, 0x7a, 0x0d, 0x45, 0x66, 0x8f, 0xd0, 0xb9, 0x9d, 0xa1, 0x1c, 0x81, 0x07, 0xfc, 0xed, 0xee, - 0xa5, 0x91, 0xa9, 0x31, 0x0f, 0xa3, 0x46, 0x83, 0x72, 0xe2, 0x21, 0x6a, 0x80, 0x1c, 0xa6, 0xfc, - 0xec, 0x88, 0xbb, 0x50, 0x64, 0x93, 0xa9, 0x02, 0x69, 0x93, 0x4b, 0x85, 0x8c, 0x4b, 0xbd, 0x6f, - 0x19, 0x94, 0xa7, 0x5f, 0x26, 0xb4, 0x00, 0x25, 0xcd, 0x31, 0xea, 0xe6, 0x89, 0xfa, 0xfb, 0xb1, - 0x69, 0xfa, 0x0e, 0x08, 0x66, 0x42, 0x04, 0xd5, 0x6c, 0xa2, 0x50, 0x3f, 0x0f, 0xbf, 0x21, 0xd6, - 0x9a, 0xb1, 0x1b, 0x88, 0xf1, 0xce, 0xe0, 0x48, 0x44, 0x03, 0xe5, 0x4a, 0x5e, 0x4f, 0xa7, 0x76, - 0xb5, 0xf5, 0xbc, 0x20, 0x32, 0xb7, 0x25, 0x32, 0x77, 0x24, 0xca, 0xc6, 0x69, 0x50, 0x7b, 0xa9, - 0xa4, 0xcd, 0xc8, 0x18, 0x97, 0xf9, 0x0f, 0xb3, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x4f, 0xab, - 0xd5, 0x54, 0x50, 0x05, 0x00, 0x00, + // 457 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x41, 0x8f, 0x93, 0x40, + 0x14, 0x0e, 0x85, 0xad, 0xf2, 0xca, 0x6e, 0x76, 0x67, 0x3d, 0x10, 0xb2, 0x31, 0xcd, 0x68, 0x4c, + 0x0f, 0x86, 0x5d, 0xda, 0x8b, 0xf1, 0xe0, 0xa1, 0x46, 0xd1, 0xc4, 0x83, 0xa1, 0x69, 0x34, 0x5e, + 0x0c, 0xad, 0xd3, 0x66, 0x62, 0x0b, 0x15, 0x06, 0x94, 0xff, 0xe0, 0x4f, 0xf2, 0xc7, 0x99, 0x19, + 0xa6, 0x03, 0xd5, 0x66, 0xa1, 0x69, 0x6f, 0x33, 0xef, 0xcd, 0xf7, 0xbe, 0xef, 0x3d, 0xde, 0x17, + 0xe0, 0x86, 0x46, 0x39, 0x89, 0x58, 0x9c, 0x14, 0xb7, 0xb9, 0x77, 0xab, 0x2e, 0xee, 0x26, 0x89, + 0x59, 0x8c, 0x1e, 0xa7, 0x9b, 0x98, 0xd1, 0x45, 0xe1, 0xce, 0xc2, 0xf9, 0xf7, 0x94, 0x85, 0x4b, + 0xe2, 0x56, 0x4f, 0x72, 0x0f, 0x8f, 0xe0, 0xfa, 0x03, 0x4d, 0xd9, 0x9b, 0x88, 0x51, 0x46, 0x49, + 0x1a, 0x90, 0x1f, 0x19, 0x49, 0x19, 0xba, 0x01, 0x33, 0x4b, 0xe8, 0xc7, 0x84, 0x2c, 0xe8, 0x2f, + 0x5b, 0xeb, 0x6b, 0x03, 0x33, 0xa8, 0x02, 0xf8, 0x13, 0x5c, 0xed, 0x82, 0x36, 0xab, 0x02, 0x8d, + 0xe1, 0x21, 0x91, 0x01, 0x5b, 0xeb, 0xeb, 0x83, 0xde, 0xf0, 0x99, 0x7b, 0x3f, 0xb9, 0x2b, 0x0a, + 0x14, 0x81, 0xc2, 0xe1, 0x9f, 0x70, 0xe9, 0x13, 0x26, 0xc3, 0x52, 0xca, 0x2b, 0xe8, 0x8a, 0x7c, + 0x21, 0x74, 0xb4, 0xaf, 0x2a, 0x51, 0xe8, 0x09, 0x9c, 0xd3, 0x68, 0xbe, 0xca, 0xbe, 0x91, 0xaf, + 0x8b, 0x70, 0xce, 0x52, 0xbb, 0xd3, 0xd7, 0x07, 0x66, 0x60, 0xc9, 0xe0, 0x5b, 0x1e, 0xc3, 0xbf, + 0x35, 0xb8, 0xa8, 0x31, 0xf3, 0x7e, 0x8e, 0xe5, 0x7d, 0x09, 0x67, 0x15, 0x5f, 0x6f, 0xf8, 0xb4, + 0x09, 0xce, 0x85, 0x04, 0x25, 0x04, 0x4f, 0xe1, 0xfa, 0x75, 0x42, 0x42, 0x46, 0x4e, 0x3a, 0x0a, + 0x3c, 0x81, 0xab, 0xdd, 0xb2, 0x27, 0xe8, 0x13, 0x7f, 0x86, 0x8b, 0x09, 0x61, 0x42, 0x7d, 0xb5, + 0x3c, 0x65, 0x6e, 0x9a, 0xd0, 0xed, 0xf2, 0xa8, 0x00, 0x42, 0x60, 0x44, 0xe1, 0x9a, 0xd8, 0x1d, + 0x91, 0x10, 0x67, 0xf4, 0x08, 0xce, 0xf2, 0x70, 0x95, 0x11, 0x5b, 0x17, 0xc1, 0xf2, 0x82, 0xdf, + 0x81, 0xa5, 0x2a, 0x73, 0xa5, 0x2f, 0xc0, 0xe0, 0xe3, 0x91, 0x3a, 0xdb, 0x0d, 0x54, 0x20, 0xf0, + 0x58, 0x7c, 0xdd, 0xa3, 0x34, 0x72, 0x35, 0xfe, 0x69, 0xd4, 0x38, 0xd0, 0x2d, 0x67, 0x88, 0x2e, + 0x41, 0xcf, 0x14, 0x3f, 0x3f, 0xe2, 0x3b, 0x30, 0xf8, 0x4b, 0xa5, 0x40, 0xdb, 0x37, 0xa5, 0x4e, + 0x6d, 0x4a, 0xc3, 0x3f, 0x06, 0x98, 0xef, 0xb7, 0x4c, 0x28, 0x07, 0xab, 0x6e, 0x4d, 0x34, 0x6a, + 0xd2, 0xb5, 0xc7, 0xfd, 0x8e, 0x77, 0x18, 0x88, 0x4f, 0x63, 0x0d, 0xa6, 0xf2, 0x0f, 0xba, 0x6b, + 0xc2, 0xff, 0x6b, 0x72, 0xc7, 0x3d, 0x00, 0xc1, 0xe9, 0x72, 0xb0, 0xea, 0x9b, 0xdc, 0xdc, 0xe6, + 0x1e, 0x3b, 0x35, 0xb7, 0xf9, 0xbf, 0x59, 0x96, 0xf0, 0x40, 0xae, 0x24, 0x6a, 0x94, 0xbc, 0xeb, + 0x0a, 0xe7, 0x79, 0xeb, 0xf7, 0x92, 0xc8, 0x6f, 0x4b, 0xe4, 0x1f, 0x48, 0x54, 0x5f, 0xe3, 0xf1, + 0xf9, 0x97, 0x9e, 0x4a, 0xe6, 0xde, 0xac, 0x2b, 0x7e, 0x1b, 0xa3, 0xbf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x0f, 0x08, 0x7c, 0x37, 0x56, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -518,6 +602,7 @@ const _ = grpc.SupportPackageIsVersion6 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type InventoryClient interface { + ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesReply, error) GetEntity(ctx context.Context, in *GetEntityRequest, opts ...grpc.CallOption) (*GetEntityReply, error) CreateEntity(ctx context.Context, in *CreateEntityRequest, opts ...grpc.CallOption) (*CreateEntityReply, error) SetFact(ctx context.Context, in *SetFactRequest, opts ...grpc.CallOption) (*SetFactReply, error) @@ -532,6 +617,15 @@ func NewInventoryClient(cc grpc.ClientConnInterface) InventoryClient { return &inventoryClient{cc} } +func (c *inventoryClient) ListEntities(ctx context.Context, in *ListEntitiesRequest, opts ...grpc.CallOption) (*ListEntitiesReply, error) { + out := new(ListEntitiesReply) + err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/ListEntities", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *inventoryClient) GetEntity(ctx context.Context, in *GetEntityRequest, opts ...grpc.CallOption) (*GetEntityReply, error) { out := new(GetEntityReply) err := c.cc.Invoke(ctx, "/spotify.backstage.inventory.v1.Inventory/GetEntity", in, out, opts...) @@ -570,6 +664,7 @@ func (c *inventoryClient) GetFact(ctx context.Context, in *GetFactRequest, opts // InventoryServer is the server API for Inventory service. type InventoryServer interface { + ListEntities(context.Context, *ListEntitiesRequest) (*ListEntitiesReply, error) GetEntity(context.Context, *GetEntityRequest) (*GetEntityReply, error) CreateEntity(context.Context, *CreateEntityRequest) (*CreateEntityReply, error) SetFact(context.Context, *SetFactRequest) (*SetFactReply, error) @@ -580,6 +675,9 @@ type InventoryServer interface { type UnimplementedInventoryServer struct { } +func (*UnimplementedInventoryServer) ListEntities(ctx context.Context, req *ListEntitiesRequest) (*ListEntitiesReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListEntities not implemented") +} func (*UnimplementedInventoryServer) GetEntity(ctx context.Context, req *GetEntityRequest) (*GetEntityReply, error) { return nil, status.Errorf(codes.Unimplemented, "method GetEntity not implemented") } @@ -597,6 +695,24 @@ func RegisterInventoryServer(s *grpc.Server, srv InventoryServer) { s.RegisterService(&_Inventory_serviceDesc, srv) } +func _Inventory_ListEntities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListEntitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryServer).ListEntities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/spotify.backstage.inventory.v1.Inventory/ListEntities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryServer).ListEntities(ctx, req.(*ListEntitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Inventory_GetEntity_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(GetEntityRequest) if err := dec(in); err != nil { @@ -673,6 +789,10 @@ var _Inventory_serviceDesc = grpc.ServiceDesc{ ServiceName: "spotify.backstage.inventory.v1.Inventory", HandlerType: (*InventoryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "ListEntities", + Handler: _Inventory_ListEntities_Handler, + }, { MethodName: "GetEntity", Handler: _Inventory_GetEntity_Handler, diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts index a01cbd4a18..da57b03eb4 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.d.ts @@ -4,13 +4,26 @@ import { CreateEntityReply, CreateEntityRequest, GetEntityReply, - GetEntityRequest} from './inventory_pb'; + GetEntityRequest, + GetFactReply, + GetFactRequest, + ListEntitiesReply, + ListEntitiesRequest, + SetFactReply, + SetFactRequest} from './inventory_pb'; export class InventoryClient { constructor (hostname: string, credentials?: null | { [index: string]: string; }, options?: null | { [index: string]: string; }); + listEntities( + request: ListEntitiesRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: ListEntitiesReply) => void + ): grpcWeb.ClientReadableStream; + getEntity( request: GetEntityRequest, metadata: grpcWeb.Metadata | undefined, @@ -25,6 +38,20 @@ export class InventoryClient { response: CreateEntityReply) => void ): grpcWeb.ClientReadableStream; + setFact( + request: SetFactRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: SetFactReply) => void + ): grpcWeb.ClientReadableStream; + + getFact( + request: GetFactRequest, + metadata: grpcWeb.Metadata | undefined, + callback: (err: grpcWeb.Error, + response: GetFactReply) => void + ): grpcWeb.ClientReadableStream; + } export class InventoryPromiseClient { @@ -32,6 +59,11 @@ export class InventoryPromiseClient { credentials?: null | { [index: string]: string; }, options?: null | { [index: string]: string; }); + listEntities( + request: ListEntitiesRequest, + metadata?: grpcWeb.Metadata + ): Promise; + getEntity( request: GetEntityRequest, metadata?: grpcWeb.Metadata @@ -42,5 +74,15 @@ export class InventoryPromiseClient { metadata?: grpcWeb.Metadata ): Promise; + setFact( + request: SetFactRequest, + metadata?: grpcWeb.Metadata + ): Promise; + + getFact( + request: GetFactRequest, + metadata?: grpcWeb.Metadata + ): Promise; + } diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js index e17a3ee3e6..1604b62d94 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_grpc_web_pb.js @@ -69,6 +69,86 @@ proto.spotify.backstage.inventory.v1.InventoryPromiseClient = }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.inventory.v1.ListEntitiesRequest, + * !proto.spotify.backstage.inventory.v1.ListEntitiesReply>} + */ +const methodDescriptor_Inventory_ListEntities = new grpc.web.MethodDescriptor( + '/spotify.backstage.inventory.v1.Inventory/ListEntities', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.inventory.v1.ListEntitiesRequest, + proto.spotify.backstage.inventory.v1.ListEntitiesReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.inventory.v1.ListEntitiesRequest, + * !proto.spotify.backstage.inventory.v1.ListEntitiesReply>} + */ +const methodInfo_Inventory_ListEntities = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.inventory.v1.ListEntitiesReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.inventory.v1.ListEntitiesReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.inventory.v1.InventoryClient.prototype.listEntities = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/ListEntities', + request, + metadata || {}, + methodDescriptor_Inventory_ListEntities, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.listEntities = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/ListEntities', + request, + metadata || {}, + methodDescriptor_Inventory_ListEntities); +}; + + /** * @const * @type {!grpc.web.MethodDescriptor< @@ -229,5 +309,165 @@ proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.createEnti }; +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.inventory.v1.SetFactRequest, + * !proto.spotify.backstage.inventory.v1.SetFactReply>} + */ +const methodDescriptor_Inventory_SetFact = new grpc.web.MethodDescriptor( + '/spotify.backstage.inventory.v1.Inventory/SetFact', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.inventory.v1.SetFactRequest, + proto.spotify.backstage.inventory.v1.SetFactReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.inventory.v1.SetFactRequest, + * !proto.spotify.backstage.inventory.v1.SetFactReply>} + */ +const methodInfo_Inventory_SetFact = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.inventory.v1.SetFactReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.inventory.v1.SetFactReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.inventory.v1.InventoryClient.prototype.setFact = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/SetFact', + request, + metadata || {}, + methodDescriptor_Inventory_SetFact, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.SetFactRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.setFact = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/SetFact', + request, + metadata || {}, + methodDescriptor_Inventory_SetFact); +}; + + +/** + * @const + * @type {!grpc.web.MethodDescriptor< + * !proto.spotify.backstage.inventory.v1.GetFactRequest, + * !proto.spotify.backstage.inventory.v1.GetFactReply>} + */ +const methodDescriptor_Inventory_GetFact = new grpc.web.MethodDescriptor( + '/spotify.backstage.inventory.v1.Inventory/GetFact', + grpc.web.MethodType.UNARY, + proto.spotify.backstage.inventory.v1.GetFactRequest, + proto.spotify.backstage.inventory.v1.GetFactReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.GetFactReply.deserializeBinary +); + + +/** + * @const + * @type {!grpc.web.AbstractClientBase.MethodInfo< + * !proto.spotify.backstage.inventory.v1.GetFactRequest, + * !proto.spotify.backstage.inventory.v1.GetFactReply>} + */ +const methodInfo_Inventory_GetFact = new grpc.web.AbstractClientBase.MethodInfo( + proto.spotify.backstage.inventory.v1.GetFactReply, + /** + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} request + * @return {!Uint8Array} + */ + function(request) { + return request.serializeBinary(); + }, + proto.spotify.backstage.inventory.v1.GetFactReply.deserializeBinary +); + + +/** + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @param {function(?grpc.web.Error, ?proto.spotify.backstage.inventory.v1.GetFactReply)} + * callback The callback function(error, response) + * @return {!grpc.web.ClientReadableStream|undefined} + * The XHR Node Readable Stream + */ +proto.spotify.backstage.inventory.v1.InventoryClient.prototype.getFact = + function(request, metadata, callback) { + return this.client_.rpcCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/GetFact', + request, + metadata || {}, + methodDescriptor_Inventory_GetFact, + callback); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} request The + * request proto + * @param {?Object} metadata User defined + * call metadata + * @return {!Promise} + * A native promise that resolves to the response + */ +proto.spotify.backstage.inventory.v1.InventoryPromiseClient.prototype.getFact = + function(request, metadata) { + return this.client_.unaryCall(this.hostname_ + + '/spotify.backstage.inventory.v1.Inventory/GetFact', + request, + metadata || {}, + methodDescriptor_Inventory_GetFact); +}; + + module.exports = proto.spotify.backstage.inventory.v1; diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts index 9f50e094ce..139857b3e2 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.d.ts @@ -1,5 +1,43 @@ import * as jspb from "google-protobuf" +export class ListEntitiesRequest extends jspb.Message { + getUriprefix(): string; + setUriprefix(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListEntitiesRequest.AsObject; + static toObject(includeInstance: boolean, msg: ListEntitiesRequest): ListEntitiesRequest.AsObject; + static serializeBinaryToWriter(message: ListEntitiesRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListEntitiesRequest; + static deserializeBinaryFromReader(message: ListEntitiesRequest, reader: jspb.BinaryReader): ListEntitiesRequest; +} + +export namespace ListEntitiesRequest { + export type AsObject = { + uriprefix: string, + } +} + +export class ListEntitiesReply extends jspb.Message { + getEntitiesList(): Array; + setEntitiesList(value: Array): void; + clearEntitiesList(): void; + addEntities(value?: Entity, index?: number): Entity; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): ListEntitiesReply.AsObject; + static toObject(includeInstance: boolean, msg: ListEntitiesReply): ListEntitiesReply.AsObject; + static serializeBinaryToWriter(message: ListEntitiesReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): ListEntitiesReply; + static deserializeBinaryFromReader(message: ListEntitiesReply, reader: jspb.BinaryReader): ListEntitiesReply; +} + +export namespace ListEntitiesReply { + export type AsObject = { + entitiesList: Array, + } +} + export class GetEntityRequest extends jspb.Message { getEntity(): Entity | undefined; setEntity(value?: Entity): void; @@ -119,8 +157,10 @@ export namespace SetFactRequest { } export class SetFactReply extends jspb.Message { - getFacturi(): string; - setFacturi(value: string): void; + getFact(): Fact | undefined; + setFact(value?: Fact): void; + hasFact(): boolean; + clearFact(): void; serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): SetFactReply.AsObject; @@ -132,7 +172,49 @@ export class SetFactReply extends jspb.Message { export namespace SetFactReply { export type AsObject = { - facturi: string, + fact?: Fact.AsObject, + } +} + +export class GetFactRequest extends jspb.Message { + getEntityuri(): string; + setEntityuri(value: string): void; + + getName(): string; + setName(value: string): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetFactRequest.AsObject; + static toObject(includeInstance: boolean, msg: GetFactRequest): GetFactRequest.AsObject; + static serializeBinaryToWriter(message: GetFactRequest, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetFactRequest; + static deserializeBinaryFromReader(message: GetFactRequest, reader: jspb.BinaryReader): GetFactRequest; +} + +export namespace GetFactRequest { + export type AsObject = { + entityuri: string, + name: string, + } +} + +export class GetFactReply extends jspb.Message { + getFact(): Fact | undefined; + setFact(value?: Fact): void; + hasFact(): boolean; + clearFact(): void; + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): GetFactReply.AsObject; + static toObject(includeInstance: boolean, msg: GetFactReply): GetFactReply.AsObject; + static serializeBinaryToWriter(message: GetFactReply, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): GetFactReply; + static deserializeBinaryFromReader(message: GetFactReply, reader: jspb.BinaryReader): GetFactReply; +} + +export namespace GetFactReply { + export type AsObject = { + fact?: Fact.AsObject, } } @@ -155,9 +237,6 @@ export namespace Entity { } export class Fact extends jspb.Message { - getEntityuri(): string; - setEntityuri(value: string): void; - getName(): string; setName(value: string): void; @@ -174,7 +253,6 @@ export class Fact extends jspb.Message { export namespace Fact { export type AsObject = { - entityuri: string, name: string, value: string, } diff --git a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js index 85a0dc2482..f3f2c5d8c9 100644 --- a/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js +++ b/frontend/packages/proto/src/generated/inventory/v1/inventory_pb.js @@ -17,8 +17,54 @@ goog.exportSymbol('proto.spotify.backstage.inventory.v1.Entity', null, global); goog.exportSymbol('proto.spotify.backstage.inventory.v1.Fact', null, global); goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetEntityReply', null, global); goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetEntityRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetFactReply', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.GetFactRequest', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.ListEntitiesReply', null, global); +goog.exportSymbol('proto.spotify.backstage.inventory.v1.ListEntitiesRequest', null, global); goog.exportSymbol('proto.spotify.backstage.inventory.v1.SetFactReply', null, global); goog.exportSymbol('proto.spotify.backstage.inventory.v1.SetFactRequest', null, global); +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.ListEntitiesRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.ListEntitiesRequest.displayName = 'proto.spotify.backstage.inventory.v1.ListEntitiesRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, proto.spotify.backstage.inventory.v1.ListEntitiesReply.repeatedFields_, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.ListEntitiesReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.ListEntitiesReply.displayName = 'proto.spotify.backstage.inventory.v1.ListEntitiesReply'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -145,6 +191,48 @@ if (goog.DEBUG && !COMPILED) { */ proto.spotify.backstage.inventory.v1.SetFactReply.displayName = 'proto.spotify.backstage.inventory.v1.SetFactReply'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.GetFactRequest = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.GetFactRequest, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.GetFactRequest.displayName = 'proto.spotify.backstage.inventory.v1.GetFactRequest'; +} +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.spotify.backstage.inventory.v1.GetFactReply = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.spotify.backstage.inventory.v1.GetFactReply, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.spotify.backstage.inventory.v1.GetFactReply.displayName = 'proto.spotify.backstage.inventory.v1.GetFactReply'; +} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -188,6 +276,289 @@ if (goog.DEBUG && !COMPILED) { proto.spotify.backstage.inventory.v1.Fact.displayName = 'proto.spotify.backstage.inventory.v1.Fact'; } + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.ListEntitiesRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.toObject = function(includeInstance, msg) { + var f, obj = { + uriprefix: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.ListEntitiesRequest; + return proto.spotify.backstage.inventory.v1.ListEntitiesRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setUriprefix(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.ListEntitiesRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getUriprefix(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string uriPrefix = 1; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.prototype.getUriprefix = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.ListEntitiesRequest.prototype.setUriprefix = function(value) { + jspb.Message.setProto3StringField(this, 1, value); +}; + + + +/** + * List of repeated fields within this message type. + * @private {!Array} + * @const + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.repeatedFields_ = [1]; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.ListEntitiesReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.toObject = function(includeInstance, msg) { + var f, obj = { + entitiesList: jspb.Message.toObjectList(msg.getEntitiesList(), + proto.spotify.backstage.inventory.v1.Entity.toObject, includeInstance) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.ListEntitiesReply} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.ListEntitiesReply; + return proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.ListEntitiesReply} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Entity; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Entity.deserializeBinaryFromReader); + msg.addEntities(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.ListEntitiesReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.ListEntitiesReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntitiesList(); + if (f.length > 0) { + writer.writeRepeatedMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Entity.serializeBinaryToWriter + ); + } +}; + + +/** + * repeated Entity entities = 1; + * @return {!Array} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.getEntitiesList = function() { + return /** @type{!Array} */ ( + jspb.Message.getRepeatedWrapperField(this, proto.spotify.backstage.inventory.v1.Entity, 1)); +}; + + +/** @param {!Array} value */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.setEntitiesList = function(value) { + jspb.Message.setRepeatedWrapperField(this, 1, value); +}; + + +/** + * @param {!proto.spotify.backstage.inventory.v1.Entity=} opt_value + * @param {number=} opt_index + * @return {!proto.spotify.backstage.inventory.v1.Entity} + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.addEntities = function(opt_value, opt_index) { + return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.spotify.backstage.inventory.v1.Entity, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + */ +proto.spotify.backstage.inventory.v1.ListEntitiesReply.prototype.clearEntitiesList = function() { + this.setEntitiesList([]); +}; + + + /** * List of repeated fields within this message type. * @private {!Array} @@ -1095,7 +1466,7 @@ proto.spotify.backstage.inventory.v1.SetFactReply.prototype.toObject = function( */ proto.spotify.backstage.inventory.v1.SetFactReply.toObject = function(includeInstance, msg) { var f, obj = { - facturi: jspb.Message.getFieldWithDefault(msg, 1, "") + fact: (f = msg.getFact()) && proto.spotify.backstage.inventory.v1.Fact.toObject(includeInstance, f) }; if (includeInstance) { @@ -1133,8 +1504,9 @@ proto.spotify.backstage.inventory.v1.SetFactReply.deserializeBinaryFromReader = var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setFacturi(value); + var value = new proto.spotify.backstage.inventory.v1.Fact; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader); + msg.setFact(value); break; default: reader.skipField(); @@ -1165,31 +1537,351 @@ proto.spotify.backstage.inventory.v1.SetFactReply.prototype.serializeBinary = fu */ proto.spotify.backstage.inventory.v1.SetFactReply.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getFacturi(); + f = message.getFact(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Fact fact = 1; + * @return {?proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.getFact = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Fact} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Fact, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Fact|undefined} value */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.setFact = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.clearFact = function() { + this.setFact(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.SetFactReply.prototype.hasFact = function() { + return jspb.Message.getField(this, 1) != null; +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.GetFactRequest.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.toObject = function(includeInstance, msg) { + var f, obj = { + entityuri: jspb.Message.getFieldWithDefault(msg, 1, ""), + name: jspb.Message.getFieldWithDefault(msg, 2, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.GetFactRequest} + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.GetFactRequest; + return proto.spotify.backstage.inventory.v1.GetFactRequest.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.GetFactRequest} + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setEntityuri(value); + break; + case 2: + var value = /** @type {string} */ (reader.readString()); + msg.setName(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.GetFactRequest.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.GetFactRequest} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getEntityuri(); if (f.length > 0) { writer.writeString( 1, f ); } + f = message.getName(); + if (f.length > 0) { + writer.writeString( + 2, + f + ); + } }; /** - * optional string factUri = 1; + * optional string entityUri = 1; * @return {string} */ -proto.spotify.backstage.inventory.v1.SetFactReply.prototype.getFacturi = function() { +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.getEntityuri = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ -proto.spotify.backstage.inventory.v1.SetFactReply.prototype.setFacturi = function(value) { +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.setEntityuri = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; +/** + * optional string name = 2; + * @return {string} + */ +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.getName = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); +}; + + +/** @param {string} value */ +proto.spotify.backstage.inventory.v1.GetFactRequest.prototype.setName = function(value) { + jspb.Message.setProto3StringField(this, 2, value); +}; + + + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.toObject = function(opt_includeInstance) { + return proto.spotify.backstage.inventory.v1.GetFactReply.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.spotify.backstage.inventory.v1.GetFactReply} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetFactReply.toObject = function(includeInstance, msg) { + var f, obj = { + fact: (f = msg.getFact()) && proto.spotify.backstage.inventory.v1.Fact.toObject(includeInstance, f) + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.spotify.backstage.inventory.v1.GetFactReply} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.spotify.backstage.inventory.v1.GetFactReply; + return proto.spotify.backstage.inventory.v1.GetFactReply.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.spotify.backstage.inventory.v1.GetFactReply} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.spotify.backstage.inventory.v1.GetFactReply} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = new proto.spotify.backstage.inventory.v1.Fact; + reader.readMessage(value,proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader); + msg.setFact(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.spotify.backstage.inventory.v1.GetFactReply.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.spotify.backstage.inventory.v1.GetFactReply} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.spotify.backstage.inventory.v1.GetFactReply.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getFact(); + if (f != null) { + writer.writeMessage( + 1, + f, + proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter + ); + } +}; + + +/** + * optional Fact fact = 1; + * @return {?proto.spotify.backstage.inventory.v1.Fact} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.getFact = function() { + return /** @type{?proto.spotify.backstage.inventory.v1.Fact} */ ( + jspb.Message.getWrapperField(this, proto.spotify.backstage.inventory.v1.Fact, 1)); +}; + + +/** @param {?proto.spotify.backstage.inventory.v1.Fact|undefined} value */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.setFact = function(value) { + jspb.Message.setWrapperField(this, 1, value); +}; + + +/** + * Clears the message field making it undefined. + */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.clearFact = function() { + this.setFact(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.spotify.backstage.inventory.v1.GetFactReply.prototype.hasFact = function() { + return jspb.Message.getField(this, 1) != null; +}; + + @@ -1349,9 +2041,8 @@ proto.spotify.backstage.inventory.v1.Fact.prototype.toObject = function(opt_incl */ proto.spotify.backstage.inventory.v1.Fact.toObject = function(includeInstance, msg) { var f, obj = { - entityuri: jspb.Message.getFieldWithDefault(msg, 1, ""), - name: jspb.Message.getFieldWithDefault(msg, 2, ""), - value: jspb.Message.getFieldWithDefault(msg, 3, "") + name: jspb.Message.getFieldWithDefault(msg, 1, ""), + value: jspb.Message.getFieldWithDefault(msg, 2, "") }; if (includeInstance) { @@ -1389,14 +2080,10 @@ proto.spotify.backstage.inventory.v1.Fact.deserializeBinaryFromReader = function var field = reader.getFieldNumber(); switch (field) { case 1: - var value = /** @type {string} */ (reader.readString()); - msg.setEntityuri(value); - break; - case 2: var value = /** @type {string} */ (reader.readString()); msg.setName(value); break; - case 3: + case 2: var value = /** @type {string} */ (reader.readString()); msg.setValue(value); break; @@ -1429,73 +2116,51 @@ proto.spotify.backstage.inventory.v1.Fact.prototype.serializeBinary = function() */ proto.spotify.backstage.inventory.v1.Fact.serializeBinaryToWriter = function(message, writer) { var f = undefined; - f = message.getEntityuri(); + f = message.getName(); if (f.length > 0) { writer.writeString( 1, f ); } - f = message.getName(); + f = message.getValue(); if (f.length > 0) { writer.writeString( 2, f ); } - f = message.getValue(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } }; /** - * optional string entityUri = 1; + * optional string name = 1; * @return {string} */ -proto.spotify.backstage.inventory.v1.Fact.prototype.getEntityuri = function() { +proto.spotify.backstage.inventory.v1.Fact.prototype.getName = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); }; /** @param {string} value */ -proto.spotify.backstage.inventory.v1.Fact.prototype.setEntityuri = function(value) { +proto.spotify.backstage.inventory.v1.Fact.prototype.setName = function(value) { jspb.Message.setProto3StringField(this, 1, value); }; /** - * optional string name = 2; + * optional string value = 2; * @return {string} */ -proto.spotify.backstage.inventory.v1.Fact.prototype.getName = function() { +proto.spotify.backstage.inventory.v1.Fact.prototype.getValue = function() { return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); }; /** @param {string} value */ -proto.spotify.backstage.inventory.v1.Fact.prototype.setName = function(value) { +proto.spotify.backstage.inventory.v1.Fact.prototype.setValue = function(value) { jspb.Message.setProto3StringField(this, 2, value); }; -/** - * optional string value = 3; - * @return {string} - */ -proto.spotify.backstage.inventory.v1.Fact.prototype.getValue = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** @param {string} value */ -proto.spotify.backstage.inventory.v1.Fact.prototype.setValue = function(value) { - jspb.Message.setProto3StringField(this, 3, value); -}; - - goog.object.extend(exports, proto.spotify.backstage.inventory.v1); diff --git a/proto/inventory/v1/inventory.proto b/proto/inventory/v1/inventory.proto index 1994a3fe01..c8aca22c2b 100644 --- a/proto/inventory/v1/inventory.proto +++ b/proto/inventory/v1/inventory.proto @@ -5,12 +5,21 @@ package spotify.backstage.inventory.v1; option go_package = "inventoryv1"; service Inventory { + rpc ListEntities(ListEntitiesRequest) returns (ListEntitiesReply); rpc GetEntity(GetEntityRequest) returns (GetEntityReply); rpc CreateEntity(CreateEntityRequest) returns (CreateEntityReply); rpc SetFact(SetFactRequest) returns (SetFactReply); rpc GetFact(GetFactRequest) returns (GetFactReply); } +message ListEntitiesRequest { + string uriPrefix = 1; +} + +message ListEntitiesReply { + repeated Entity entities = 1; +} + message GetEntityRequest { Entity entity = 1; repeated string include_facts = 2;