-
Notifications
You must be signed in to change notification settings - Fork 8
/
webrtc.go
67 lines (52 loc) · 2.06 KB
/
webrtc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package models
import (
"bytes"
)
type WebRTCIOS struct {
ApnsCertificateFileName string `json:"apnsCertificateFileName" validate:"required"`
ApnsCertificateFileContent string `json:"apnsCertificateFileContent" validate:"required"`
ApnsCertificatePassword string `json:"apnsCertificatePassword"`
}
type WebRTCAndroid struct {
FcmServerKey string `json:"fcmServerKey" validate:"required"`
}
type GetWebRTCApplicationsResponse []WebRTCApplication
type WebRTCApplication struct {
ID string `json:"id"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
IOS *WebRTCIOS `json:"ios,omitempty"`
Android *WebRTCAndroid `json:"android,omitempty"`
AppToApp bool `json:"appToApp"`
AppToConversations bool `json:"appToConversations"`
AppToPhone bool `json:"appToPhone"`
}
func (w *WebRTCApplication) Validate() error {
return validate.Struct(w)
}
func (w *WebRTCApplication) Marshal() (*bytes.Buffer, error) {
return marshalJSON(w)
}
type SaveWebRTCApplicationResponse WebRTCApplication
type GetWebRTCApplicationResponse WebRTCApplication
type UpdateWebRTCApplicationResponse WebRTCApplication
type WebRTCTokenCapabilities struct {
Recording string `json:"recording" validate:"omitempty,oneof=ALWAYS ON_DEMAND DISABLED"`
}
type GenerateWebRTCTokenRequest struct {
Identity string `json:"identity" validate:"required,min=3,max=64"`
ApplicationID string `json:"applicationId"`
DisplayName string `json:"displayName"`
Capabilities *WebRTCTokenCapabilities `json:"capabilities"`
TimeToLive int64 `json:"timeToLive"`
}
func (g *GenerateWebRTCTokenRequest) Validate() error {
return validate.Struct(g)
}
func (g *GenerateWebRTCTokenRequest) Marshal() (*bytes.Buffer, error) {
return marshalJSON(g)
}
type GenerateWebRTCTokenResponse struct {
Token string `json:"token"`
ExpirationTime string `json:"expirationTime"`
}