2022-06-06 17:00:39 +00:00
|
|
|
{{define "service"}}
|
2022-06-08 06:05:49 +00:00
|
|
|
{{- $Imps := .Imps -}}
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- $Types := .Types -}}
|
2022-06-08 17:13:28 +00:00
|
|
|
// Package {{.Manifest.Package}} provides types for the {{quote .Manifest.ServiceType}} service.
|
2022-06-13 17:06:03 +00:00
|
|
|
{{- with .Manifest.DocumentURL}}
|
|
|
|
//
|
|
|
|
// Documented at {{.}}.
|
|
|
|
{{- end}}
|
2022-06-06 17:03:17 +00:00
|
|
|
package {{.Manifest.Package}}
|
2022-06-06 17:00:39 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
{{- range .Imps.ImportLines}}
|
2022-06-08 06:30:01 +00:00
|
|
|
{{.Alias}} {{quote .Path}}
|
2022-06-06 17:00:39 +00:00
|
|
|
{{- end}}
|
|
|
|
)
|
2022-06-08 16:51:47 +00:00
|
|
|
|
2023-03-09 18:23:18 +00:00
|
|
|
{{range .Types.StringVarDefs}}
|
|
|
|
{{- $Name := .Name}}
|
|
|
|
{{- with .AllowedValues}}
|
|
|
|
// Allowed values for state variable {{$Name}}.
|
|
|
|
const (
|
|
|
|
{{- range .}}
|
|
|
|
{{$Name}}_{{.}} = "{{.}}"
|
|
|
|
{{- end}}
|
|
|
|
)
|
|
|
|
{{- end}}
|
|
|
|
{{- end}}
|
|
|
|
|
2022-06-08 16:51:47 +00:00
|
|
|
const ServiceType = {{quote .Manifest.ServiceType}}
|
2022-06-06 17:00:39 +00:00
|
|
|
{{range .SCPD.SortedActions}}
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- template "action" args "Action" . "Imps" $Imps "Types" $Types}}
|
2022-06-06 17:00:39 +00:00
|
|
|
{{end}}
|
2022-06-13 06:31:03 +00:00
|
|
|
{{- end}}
|
2022-06-06 17:00:39 +00:00
|
|
|
|
|
|
|
{{define "action"}}
|
2022-06-08 06:05:49 +00:00
|
|
|
{{- $Imps := .Imps}}
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- $Types := .Types}}
|
|
|
|
{{- $soapActionType := index $Types.TypeByName "SOAPActionInterface"}}
|
2022-06-08 17:13:28 +00:00
|
|
|
// {{.Action.Name}} provides request and response for the action.
|
|
|
|
//
|
|
|
|
// ServiceType implements {{$soapActionType.AbsRef}}, self-describing the SOAP action.
|
2022-06-08 16:51:47 +00:00
|
|
|
type {{.Action.Name}} struct{
|
|
|
|
Request {{.Action.Name}}Request
|
|
|
|
Response {{.Action.Name}}Response
|
|
|
|
}
|
|
|
|
|
2022-06-08 17:13:28 +00:00
|
|
|
var _ {{$soapActionType.Ref}} = &{{.Action.Name}}{{"{}"}}
|
2022-06-08 16:51:47 +00:00
|
|
|
|
2022-06-08 17:13:28 +00:00
|
|
|
// ServiceType implements {{$soapActionType.AbsRef}}.
|
2022-06-08 16:51:47 +00:00
|
|
|
func (a *{{.Action.Name}}) ServiceType() string { return ServiceType }
|
2022-06-08 17:13:28 +00:00
|
|
|
// ActionName implements {{$soapActionType.AbsRef}}.
|
2022-06-08 16:51:47 +00:00
|
|
|
func (a *{{.Action.Name}}) ActionName() string { return {{quote .Action.Name}} }
|
2022-06-08 17:13:28 +00:00
|
|
|
// RefRequest implements {{$soapActionType.AbsRef}}.
|
2022-06-08 16:51:47 +00:00
|
|
|
func (a *{{.Action.Name}}) RefRequest() any { return &a.Request }
|
2022-06-08 17:13:28 +00:00
|
|
|
// RefResponse implements {{$soapActionType.AbsRef}}.
|
2022-06-08 16:51:47 +00:00
|
|
|
func (a *{{.Action.Name}}) RefResponse() any { return &a.Response }
|
|
|
|
|
2022-06-08 17:13:28 +00:00
|
|
|
// {{.Action.Name}}Request contains the "in" args for the {{quote .Action.Name}} action.
|
2022-06-08 06:05:49 +00:00
|
|
|
type {{.Action.Name}}Request struct
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- template "args" args "Args" .Action.InArgs "Imps" $Imps "Types" $Types}}
|
2022-06-06 17:00:39 +00:00
|
|
|
|
2022-06-08 17:13:28 +00:00
|
|
|
// {{.Action.Name}}Response contains the "out" args for the {{quote .Action.Name}} action.
|
2022-06-08 06:05:49 +00:00
|
|
|
type {{.Action.Name}}Response struct
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- template "args" args "Args" .Action.OutArgs "Imps" $Imps "Types" $Types}}
|
2022-06-06 17:00:39 +00:00
|
|
|
{{- end}}
|
|
|
|
|
|
|
|
{{define "args"}}
|
2022-06-08 06:05:49 +00:00
|
|
|
{{- $Imps := .Imps -}}
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- $Types := .Types -}}
|
2022-06-08 06:05:49 +00:00
|
|
|
{ {{- with .Args}}
|
|
|
|
{{- range .}}
|
2023-03-09 18:23:18 +00:00
|
|
|
{{- $fieldType := index $Types.TypeByName .RelatedStateVariable.DataType}}
|
|
|
|
// {{.Name}} relates to state variable {{.RelatedStateVariable.Name}}
|
|
|
|
{{- with .RelatedStateVariable.AllowedValues}}
|
|
|
|
{{- ""}} ({{len .}} standard allowed values)
|
|
|
|
{{- end }}.
|
2022-06-08 17:13:28 +00:00
|
|
|
{{.Name}} {{$fieldType.Ref}}
|
2022-06-06 17:05:41 +00:00
|
|
|
{{- end}}
|
2022-06-08 06:05:49 +00:00
|
|
|
{{end -}} }
|
2022-06-06 17:00:39 +00:00
|
|
|
{{- end}}
|