goldgorilla/models/dto/room.go

40 lines
905 B
Go
Raw Permalink Normal View History

package dto
import "github.com/pion/webrtc/v3"
type PeerDTO struct {
RoomId string `json:"roomId"`
ID uint64 `json:"id"`
}
func (model *PeerDTO) Validate() bool {
return len(model.RoomId) > 0
}
type CreatePeerReqModel struct {
PeerDTO
2023-11-02 11:42:30 +00:00
GGID uint64 `json:"ggid"`
CanPublish bool `json:"canPublish"`
IsCaller bool `json:"isCaller"`
}
type AddPeerICECandidateReqModel struct {
PeerDTO
2023-11-02 11:42:30 +00:00
GGID uint64 `json:"ggid"`
ICECandidate webrtc.ICECandidateInit `json:"iceCandidate"`
}
func (model *AddPeerICECandidateReqModel) Validate() bool {
return model.PeerDTO.Validate() // && len(model.ICECandidate.Candidate) > 0
}
type SetSDPReqModel struct {
PeerDTO
2023-11-02 11:42:30 +00:00
GGID uint64 `json:"ggid"`
SDP webrtc.SessionDescription `json:"sdp"`
}
func (model *SetSDPReqModel) Validate() bool {
return model.PeerDTO.Validate() && len(model.SDP.SDP) > 0
}