-
Notifications
You must be signed in to change notification settings - Fork 1
/
smilFile.go
54 lines (42 loc) · 1.73 KB
/
smilFile.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
package wserest
import (
"github.com/openfresh/wse-rest-library-go/entity/application/helper"
"github.com/openfresh/wse-rest-library-go/entity/base"
)
// SmilFile is SMIL Files utitility
type SmilFile struct {
wowza
}
// NewSmilFile create SmilFile
func NewSmilFile(settings *helper.Settings, appName string) *SmilFile {
s := new(SmilFile)
s.init(settings)
s.props["smilStreams"] = []string{}
s.baseURI = s.host() + "/servers/" + s.serverInstance() + "/vhosts/" + s.vHostInstance() + "/applications/" + appName + "/smilfiles"
return s
}
// Create adds the specified SMIL File configuration
func (s *SmilFile) Create(fileName string, streams []map[string]interface{}) (map[string]interface{}, error) {
s.setRestURI(s.baseURI + "/" + fileName)
s.props["smilStreams"] = streams
response, err := s.sendRequest(s.preparePropertiesForRequest(), []base.Entity{}, POST, "")
return response, err
}
// Get retrieves the specified SMIL File configuration
func (s *SmilFile) Get(fileName string) (map[string]interface{}, error) {
s.AddSkipParameter("smilStreams")
s.setRestURI(s.baseURI + "/" + fileName)
return s.sendRequest(s.preparePropertiesForRequest(), []base.Entity{}, GET, "")
}
// GetAll retrieves the list of SMIL Files for the specified Application
func (s *SmilFile) GetAll() (map[string]interface{}, error) {
s.AddSkipParameter("smilStreams")
s.setRestURI(s.baseURI)
return s.sendRequest(s.preparePropertiesForRequest(), []base.Entity{}, GET, "")
}
// Remove deletes the specified SMIL File configuration
func (s *SmilFile) Remove(fileName string) (map[string]interface{}, error) {
s.AddSkipParameter("smilStreams")
s.setRestURI(s.baseURI + "/" + fileName)
return s.sendRequest(s.preparePropertiesForRequest(), []base.Entity{}, DELETE, "")
}