Inline request/response structures.

This commit is contained in:
John Beisley 2013-12-31 17:06:15 +00:00
parent d2cd2978d9
commit 50cfea8d4f
3 changed files with 1852 additions and 2755 deletions

View File

@ -34,19 +34,6 @@ type {{$srvIdent}} struct {
{{range .SCPD.Actions}}{{/* loops over *SCPDWithURN values */}} {{range .SCPD.Actions}}{{/* loops over *SCPDWithURN values */}}
{{$reqType := printf "_%s_%s_Request" $srvIdent .Name}}
{{$respType := printf "_%s_%s_Response" $srvIdent .Name}}
// {{$reqType}} is the XML structure for the input arguments for action {{.Name}}.
type {{$reqType}} struct {{"{"}}{{range .Arguments}}{{if .IsInput}}
{{.Name}} string
{{end}}{{end}}}
// {{$respType}} is the XML structure for the output arguments for action {{.Name}}.
type {{$respType}} struct {{"{"}}{{range .Arguments}}{{if .IsOutput}}
{{.Name}} string
{{end}}{{end}}}
// {{.Name}} action. // {{.Name}} action.
// Arguments: // Arguments:
//{{range .Arguments}}{{if .IsInput}} //{{range .Arguments}}{{if .IsInput}}
@ -75,7 +62,9 @@ func (client *{{$srvIdent}}) {{.Name}}({{range .Arguments}}{{if .IsInput}}
{{$argWrap := $srv.Argument .}}{{$argWrap.AsParameter}},{{end}}{{end}} {{$argWrap := $srv.Argument .}}{{$argWrap.AsParameter}},{{end}}{{end}}
err error, err error,
) { ) {
var request {{$reqType}} // Request structure.
var request struct {{"{"}}{{range .Arguments}}{{if .IsInput}}{{.Name}} string
{{end}}{{end}}}
// BEGIN Marshal arguments into request. // BEGIN Marshal arguments into request.
{{range .Arguments}}{{if .IsInput}}{{$argWrap := $srv.Argument .}} {{range .Arguments}}{{if .IsInput}}{{$argWrap := $srv.Argument .}}
if request.{{.Name}}, err = {{$argWrap.Marshal}}; err != nil { if request.{{.Name}}, err = {{$argWrap.Marshal}}; err != nil {
@ -84,8 +73,11 @@ func (client *{{$srvIdent}}) {{.Name}}({{range .Arguments}}{{if .IsInput}}
{{end}}{{end}} {{end}}{{end}}
// END Marshal arguments into request. // END Marshal arguments into request.
// Response structure.
var response struct {{"{"}}{{range .Arguments}}{{if .IsOutput}}{{.Name}} string
{{end}}{{end}}}
// Perform the SOAP call. // Perform the SOAP call.
var response {{$respType}}
if err = client.SOAPClient.PerformAction({{$srv.URNParts.Const}}, "{{.Name}}", &request, &response); err != nil { if err = client.SOAPClient.PerformAction({{$srv.URNParts.Const}}, "{{.Name}}", &request, &response); err != nil {
return return
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff