type definition of room name (#311)
* WIP commit * update protocol * Fixing a test and catching one place where casting was missed * Fix one more spot which need conversion from livekit.RoomName -> string * do not covert list
This commit is contained in:
+17
-17
@@ -48,7 +48,7 @@ func (s *RoomService) ListRooms(ctx context.Context, req *livekit.ListRoomsReque
|
||||
|
||||
var names []livekit.RoomName
|
||||
if len(req.Names) > 0 {
|
||||
names = req.Names
|
||||
names = livekit.StringsAsRoomNames(req.Names)
|
||||
}
|
||||
rooms, err := s.roomStore.ListRooms(ctx, names)
|
||||
if err != nil {
|
||||
@@ -66,7 +66,7 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
if err := EnsureCreatePermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
err := s.router.WriteRoomRTC(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err := s.router.WriteRoomRTC(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_DeleteRoom{
|
||||
DeleteRoom: req,
|
||||
},
|
||||
@@ -79,11 +79,11 @@ func (s *RoomService) DeleteRoom(ctx context.Context, req *livekit.DeleteRoomReq
|
||||
}
|
||||
|
||||
func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListParticipantsRequest) (res *livekit.ListParticipantsResponse, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participants, err := s.roomStore.ListParticipants(ctx, req.Room)
|
||||
participants, err := s.roomStore.ListParticipants(ctx, livekit.RoomName(req.Room))
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -95,11 +95,11 @@ func (s *RoomService) ListParticipants(ctx context.Context, req *livekit.ListPar
|
||||
}
|
||||
|
||||
func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.ParticipantInfo, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
@@ -109,7 +109,7 @@ func (s *RoomService) GetParticipant(ctx context.Context, req *livekit.RoomParti
|
||||
}
|
||||
|
||||
func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomParticipantIdentity) (res *livekit.RemoveParticipantResponse, err error) {
|
||||
err = s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_RemoveParticipant{
|
||||
RemoveParticipant: req,
|
||||
},
|
||||
@@ -123,11 +123,11 @@ func (s *RoomService) RemoveParticipant(ctx context.Context, req *livekit.RoomPa
|
||||
}
|
||||
|
||||
func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteRoomTrackRequest) (res *livekit.MuteRoomTrackResponse, err error) {
|
||||
if err = EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err = EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -139,7 +139,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
return nil, twirp.NotFoundError(ErrTrackNotFound.Error())
|
||||
}
|
||||
|
||||
err = s.writeParticipantMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err = s.writeParticipantMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_MuteTrack{
|
||||
MuteTrack: req,
|
||||
},
|
||||
@@ -157,7 +157,7 @@ func (s *RoomService) MutePublishedTrack(ctx context.Context, req *livekit.MuteR
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.UpdateParticipantRequest) (*livekit.ParticipantInfo, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateParticipant{
|
||||
UpdateParticipant: req,
|
||||
},
|
||||
@@ -166,7 +166,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
return nil, err
|
||||
}
|
||||
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, req.Room, req.Identity)
|
||||
participant, err := s.roomStore.LoadParticipant(ctx, livekit.RoomName(req.Room), req.Identity)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -176,7 +176,7 @@ func (s *RoomService) UpdateParticipant(ctx context.Context, req *livekit.Update
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.UpdateSubscriptionsRequest) (*livekit.UpdateSubscriptionsResponse, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, req.Identity, &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), req.Identity, &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateSubscriptions{
|
||||
UpdateSubscriptions: req,
|
||||
},
|
||||
@@ -189,7 +189,7 @@ func (s *RoomService) UpdateSubscriptions(ctx context.Context, req *livekit.Upda
|
||||
}
|
||||
|
||||
func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest) (*livekit.SendDataResponse, error) {
|
||||
err := s.writeRoomMessage(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err := s.writeRoomMessage(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_SendData{
|
||||
SendData: req,
|
||||
},
|
||||
@@ -202,18 +202,18 @@ func (s *RoomService) SendData(ctx context.Context, req *livekit.SendDataRequest
|
||||
}
|
||||
|
||||
func (s *RoomService) UpdateRoomMetadata(ctx context.Context, req *livekit.UpdateRoomMetadataRequest) (*livekit.Room, error) {
|
||||
if err := EnsureAdminPermission(ctx, req.Room); err != nil {
|
||||
if err := EnsureAdminPermission(ctx, livekit.RoomName(req.Room)); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
room, err := s.roomStore.LoadRoom(ctx, req.Room)
|
||||
room, err := s.roomStore.LoadRoom(ctx, livekit.RoomName(req.Room))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
room.Metadata = req.Metadata
|
||||
|
||||
err = s.writeRoomMessage(ctx, req.Room, "", &livekit.RTCNodeMessage{
|
||||
err = s.writeRoomMessage(ctx, livekit.RoomName(req.Room), "", &livekit.RTCNodeMessage{
|
||||
Message: &livekit.RTCNodeMessage_UpdateRoomMetadata{
|
||||
UpdateRoomMetadata: req,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user