-
Notifications
You must be signed in to change notification settings - Fork 1
/
register_app.go
40 lines (37 loc) · 1.52 KB
/
register_app.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
package gateway
import (
"encoding/xml"
"github.com/nitram509/gofritz/pkg/soap"
"github.com/nitram509/gofritz/pkg/tr064model"
)
// RegisterApp AUTO-GENERATED (do not edit) code from [x_appsetupSCPD],
// based on SOAP action 'RegisterApp', Fritz!Box-System-Version 164.07.57
//
// [x_appsetupSCPD]: http://fritz.box:49000/x_appsetupSCPD.xml
func RegisterApp(session *soap.SoapSession, appId string, appDisplayName string, appDeviceMac string, appUsername string, appPassword string, appRight string, nasRight string, phoneRight string, homeautoRight string, appInternetRights bool) (tr064model.RegisterAppResponse, error) {
fbAction, err := soap.NewSoapRequest(session).
ReqPath("/upnp/control/x_appsetup").
Uri("urn:dslforum-org:service:X_AVM-DE_AppSetup:1").
Action("RegisterApp").
AddStringParam("NewAppId", appId).
AddStringParam("NewAppDisplayName", appDisplayName).
AddStringParam("NewAppDeviceMAC", appDeviceMac).
AddStringParam("NewAppUsername", appUsername).
AddStringParam("NewAppPassword", appPassword).
AddStringParam("NewAppRight", appRight).
AddStringParam("NewNasRight", nasRight).
AddStringParam("NewPhoneRight", phoneRight).
AddStringParam("NewHomeautoRight", homeautoRight).
AddBoolParam("NewAppInternetRights", appInternetRights).
Do()
if err != nil {
return tr064model.RegisterAppResponse{}, err
}
bodyData := fbAction.Body.Data
result := tr064model.RegisterAppResponse{}
err = xml.Unmarshal(bodyData, &result)
if err != nil {
return tr064model.RegisterAppResponse{}, err
}
return result, nil
}