// Code generated by go-swagger; DO NOT EDIT.

package gateway_service

// 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"
)

// New creates a new gateway service API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

// New creates a new gateway service API client with basic auth credentials.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - user: user for basic authentication header.
// - password: password for basic authentication header.
func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BasicAuth(user, password)
	return &Client{transport: transport, formats: strfmt.Default}
}

// New creates a new gateway service API client with a bearer token for authentication.
// It takes the following parameters:
// - host: http host (github.com).
// - basePath: any base path for the API client ("/v1", "/v3").
// - scheme: http scheme ("http", "https").
// - bearerToken: bearer token for Bearer authentication header.
func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService {
	transport := httptransport.New(host, basePath, []string{scheme})
	transport.DefaultAuthentication = httptransport.BearerToken(bearerToken)
	return &Client{transport: transport, formats: strfmt.Default}
}

/*
Client for gateway service API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	GatewayServiceCreate(params *GatewayServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceCreateOK, error)

	GatewayServiceDelete(params *GatewayServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteOK, error)

	GatewayServiceDeleteRelayGateway(params *GatewayServiceDeleteRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteRelayGatewayOK, error)

	GatewayServiceGenerateClientCertificate(params *GatewayServiceGenerateClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGenerateClientCertificateOK, error)

	GatewayServiceGet(params *GatewayServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetOK, error)

	GatewayServiceGetDutyCycleMetrics(params *GatewayServiceGetDutyCycleMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetDutyCycleMetricsOK, error)

	GatewayServiceGetMetrics(params *GatewayServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetMetricsOK, error)

	GatewayServiceGetRelayGateway(params *GatewayServiceGetRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetRelayGatewayOK, error)

	GatewayServiceList(params *GatewayServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListOK, error)

	GatewayServiceListRelayGateways(params *GatewayServiceListRelayGatewaysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListRelayGatewaysOK, error)

	GatewayServiceUpdate(params *GatewayServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateOK, error)

	GatewayServiceUpdateRelayGateway(params *GatewayServiceUpdateRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateRelayGatewayOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
GatewayServiceCreate creates creates the given gateway
*/
func (a *Client) GatewayServiceCreate(params *GatewayServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceCreateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceCreateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_Create",
		Method:             "POST",
		PathPattern:        "/api/gateways",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceCreateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceCreateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceCreateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceDelete deletes deletes the gateway matching the given gateway ID
*/
func (a *Client) GatewayServiceDelete(params *GatewayServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/gateways/{gatewayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceDeleteReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceDeleteRelayGateway deletes the given relay gateway
*/
func (a *Client) GatewayServiceDeleteRelayGateway(params *GatewayServiceDeleteRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceDeleteRelayGatewayOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceDeleteRelayGatewayParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_DeleteRelayGateway",
		Method:             "DELETE",
		PathPattern:        "/api/gateways/relay-gateways/{tenantId}/{relayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceDeleteRelayGatewayReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceDeleteRelayGatewayOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceDeleteRelayGatewayDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceGenerateClientCertificate generates client certificate for the gateway
*/
func (a *Client) GatewayServiceGenerateClientCertificate(params *GatewayServiceGenerateClientCertificateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGenerateClientCertificateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceGenerateClientCertificateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_GenerateClientCertificate",
		Method:             "POST",
		PathPattern:        "/api/gateways/{gatewayId}/generate-certificate",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceGenerateClientCertificateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceGenerateClientCertificateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceGenerateClientCertificateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceGet gets returns the gateway for the given gateway ID
*/
func (a *Client) GatewayServiceGet(params *GatewayServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_Get",
		Method:             "GET",
		PathPattern:        "/api/gateways/{gatewayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceGetReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceGetDutyCycleMetrics gets duty cycle metrics returns the duty cycle metrics note that only the last 2 hours of data are stored currently only per minute aggregation is available
*/
func (a *Client) GatewayServiceGetDutyCycleMetrics(params *GatewayServiceGetDutyCycleMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetDutyCycleMetricsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceGetDutyCycleMetricsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_GetDutyCycleMetrics",
		Method:             "GET",
		PathPattern:        "/api/gateways/{gatewayId}/duty-cycle-metrics",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceGetDutyCycleMetricsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceGetDutyCycleMetricsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceGetDutyCycleMetricsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceGetMetrics gets metrics returns the gateway metrics
*/
func (a *Client) GatewayServiceGetMetrics(params *GatewayServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetMetricsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceGetMetricsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_GetMetrics",
		Method:             "GET",
		PathPattern:        "/api/gateways/{gatewayId}/metrics",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceGetMetricsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceGetMetricsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceGetMetricsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceGetRelayGateway gets the given relay gateway
*/
func (a *Client) GatewayServiceGetRelayGateway(params *GatewayServiceGetRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceGetRelayGatewayOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceGetRelayGatewayParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_GetRelayGateway",
		Method:             "GET",
		PathPattern:        "/api/gateways/relay-gateways/{tenantId}/{relayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceGetRelayGatewayReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceGetRelayGatewayOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceGetRelayGatewayDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceList gets the list of gateways
*/
func (a *Client) GatewayServiceList(params *GatewayServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_List",
		Method:             "GET",
		PathPattern:        "/api/gateways",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceListReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceListRelayGateways lists the detected relay gateways
*/
func (a *Client) GatewayServiceListRelayGateways(params *GatewayServiceListRelayGatewaysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceListRelayGatewaysOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceListRelayGatewaysParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_ListRelayGateways",
		Method:             "GET",
		PathPattern:        "/api/gateways/relay-gateways",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceListRelayGatewaysReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceListRelayGatewaysOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceListRelayGatewaysDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceUpdate updates updates the given gateway
*/
func (a *Client) GatewayServiceUpdate(params *GatewayServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_Update",
		Method:             "PUT",
		PathPattern:        "/api/gateways/{gateway.gatewayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceUpdateReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceUpdateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
GatewayServiceUpdateRelayGateway updates the given relay gateway
*/
func (a *Client) GatewayServiceUpdateRelayGateway(params *GatewayServiceUpdateRelayGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GatewayServiceUpdateRelayGatewayOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGatewayServiceUpdateRelayGatewayParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GatewayService_UpdateRelayGateway",
		Method:             "PUT",
		PathPattern:        "/api/gateways/relay-gateways/{relayGateway.tenantId}/{relayGateway.relayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GatewayServiceUpdateRelayGatewayReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GatewayServiceUpdateRelayGatewayOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GatewayServiceUpdateRelayGatewayDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
