// Code generated by go-swagger; DO NOT EDIT. {{ if .Copyright -}}// {{ comment .Copyright -}}{{ end }} package {{ .Name }} // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "net/http" "github.com/go-openapi/errors" "github.com/go-openapi/swag" "github.com/go-openapi/runtime" "github.com/go-openapi/validate" strfmt "github.com/go-openapi/strfmt" {{ range .DefaultImports }}{{ printf "%q" .}} {{ end }} {{ range $key, $value := .Imports }}{{ $key }} {{ printf "%q" $value }} {{ end }} ) // New creates a new {{ humanize .Name }} API client. func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { return &Client{transport: transport, formats: formats} } /* Client {{ if .Summary }}{{ .Summary }}{{ if .Description }} {{ blockcomment .Description }}{{ end }}{{ else if .Description}}{{ blockcomment .Description }}{{ else }}for {{ humanize .Name }} API{{ end }} */ type Client struct { transport runtime.ClientTransport formats strfmt.Registry } // NewClient will return a new client with the given transport and formats func NewClient(transport runtime.ClientTransport, formats strfmt.Registry) *Client { return &Client{ transport: transport, formats: formats, } } {{ range .Operations }}/* {{ pascalize .Name }} {{ if .Summary }}{{ pluralizeFirstWord (humanize .Summary) }}{{ if .Description }} {{ blockcomment .Description }}{{ end }}{{ else if .Description}}{{ blockcomment .Description }}{{ else }}{{ humanize .Name }} API{{ end }} */ func (a *Client) {{ pascalize .Name }}(params *{{ pascalize .Name }}Params{{ if .Authorized }}, authInfo runtime.ClientAuthInfoWriter{{end}}{{ if .HasStreamingResponse }}, writer io.Writer{{ end }}) {{ if .SuccessResponse }}({{ range .SuccessResponses }}*{{ pascalize .Name }}, {{ end }}{{ end }}error{{ if .SuccessResponse }}){{ end }} { // TODO: Validate the params before sending if params == nil { params = New{{ pascalize .Name }}Params() } {{ $length := len .SuccessResponses }} {{ if .SuccessResponse }}result{{else}}_{{ end }}, err := a.transport.Submit(&runtime.ClientOperation{ ID: {{ printf "%q" .Name }}, Method: {{ printf "%q" .Method }}, PathPattern: {{ printf "%q" .Path }}, ProducesMediaTypes: {{ printf "%#v" .ProducesMediaTypes }}, ConsumesMediaTypes: {{ printf "%#v" .ConsumesMediaTypes }}, Schemes: {{ printf "%#v" .Schemes }}, Params: params, Reader: &{{ pascalize .Name }}Reader{formats: a.formats{{ if .HasStreamingResponse }}, writer: writer{{ end }}},{{ if .Authorized }} AuthInfo: authInfo,{{ end}} Context: params.Context, Client: params.HTTPClient, }) if err != nil { return {{ if .SuccessResponse }}{{ padSurround "nil" "nil" 0 $length }}, {{ end }}err } {{ if .SuccessResponse }}{{ if eq $length 1 }}return result.(*{{ pascalize .SuccessResponse.Name }}), nil{{ else }}switch value := result.(type) { {{ range $i, $v := .SuccessResponses }} case *{{ pascalize $v.Name }}: return {{ padSurround "value" "nil" $i $length }}, nil{{ end }} } return {{ padSurround "nil" "nil" 0 $length }}, nil{{ end }} {{ else }}return nil{{ end }} } {{ end }} // SetTransport changes the transport on the client func (a *Client) SetTransport(transport runtime.ClientTransport) { a.transport = transport } // ClientIface is an interface that can be used to mock out a Firecracker agent // for testing purposes. type ClientIface interface { {{ range .Operations -}} {{ pascalize .Name }}(params *{{ pascalize .Name }}Params{{ if .Authorized }}, authInfo runtime.ClientAuthInfoWriter{{end}}{{ if .HasStreamingResponse }}, writer io.Writer{{ end }}) {{ if .SuccessResponse }}({{ range .SuccessResponses }}*{{ pascalize .Name }}, {{ end }}{{ end }}error{{ if .SuccessResponse }}){{ end }} {{ end -}} }