// Code generated by go-swagger; DO NOT EDIT. // (c) 2012-2020 by Telnexus LLC // All rights reserved worldwide. // Proprietary product; unlicensed use is not allowed package voip_client // This file was generated by the swagger tool. // Editing this file might prove futile when you re-run the swagger generate command import ( "github.com/go-openapi/runtime" httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/authority" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/endpoint" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/pbx" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/pbx_user" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/phone_number" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/queue" "code.tnxs.net/vernonkeenan/lib/api/voip/voip_client/vm_box" ) // Default voip HTTP client. var Default = NewHTTPClient(nil) const ( // DefaultHost is the default Host // found in Meta (info) section of spec file DefaultHost string = "voip.infra.tnxs.net:8080" // DefaultBasePath is the default BasePath // found in Meta (info) section of spec file DefaultBasePath string = "/v1" ) // DefaultSchemes are the default schemes found in Meta (info) section of spec file var DefaultSchemes = []string{"http"} // NewHTTPClient creates a new voip HTTP client. func NewHTTPClient(formats strfmt.Registry) *Voip { return NewHTTPClientWithConfig(formats, nil) } // NewHTTPClientWithConfig creates a new voip HTTP client, // using a customizable transport config. func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *Voip { // ensure nullable parameters have default if cfg == nil { cfg = DefaultTransportConfig() } // create transport and client transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) return New(transport, formats) } // New creates a new voip client func New(transport runtime.ClientTransport, formats strfmt.Registry) *Voip { // ensure nullable parameters have default if formats == nil { formats = strfmt.Default } cli := new(Voip) cli.Transport = transport cli.Authority = authority.New(transport, formats) cli.Endpoint = endpoint.New(transport, formats) cli.Pbx = pbx.New(transport, formats) cli.PbxUser = pbx_user.New(transport, formats) cli.PhoneNumber = phone_number.New(transport, formats) cli.Queue = queue.New(transport, formats) cli.VMBox = vm_box.New(transport, formats) return cli } // DefaultTransportConfig creates a TransportConfig with the // default settings taken from the meta section of the spec file. func DefaultTransportConfig() *TransportConfig { return &TransportConfig{ Host: DefaultHost, BasePath: DefaultBasePath, Schemes: DefaultSchemes, } } // TransportConfig contains the transport related info, // found in the meta section of the spec file. type TransportConfig struct { Host string BasePath string Schemes []string } // WithHost overrides the default host, // provided by the meta section of the spec file. func (cfg *TransportConfig) WithHost(host string) *TransportConfig { cfg.Host = host return cfg } // WithBasePath overrides the default basePath, // provided by the meta section of the spec file. func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { cfg.BasePath = basePath return cfg } // WithSchemes overrides the default schemes, // provided by the meta section of the spec file. func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { cfg.Schemes = schemes return cfg } // Voip is a client for voip type Voip struct { Authority authority.ClientService Endpoint endpoint.ClientService Pbx pbx.ClientService PbxUser pbx_user.ClientService PhoneNumber phone_number.ClientService Queue queue.ClientService VMBox vm_box.ClientService Transport runtime.ClientTransport } // SetTransport changes the transport on the client and all its subresources func (c *Voip) SetTransport(transport runtime.ClientTransport) { c.Transport = transport c.Authority.SetTransport(transport) c.Endpoint.SetTransport(transport) c.Pbx.SetTransport(transport) c.PbxUser.SetTransport(transport) c.PhoneNumber.SetTransport(transport) c.Queue.SetTransport(transport) c.VMBox.SetTransport(transport) }