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

package multicast_group_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 multicast group service API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

// New creates a new multicast group 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 multicast group 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 multicast group 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 {
	MulticastGroupServiceAddDevice(params *MulticastGroupServiceAddDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddDeviceOK, error)

	MulticastGroupServiceAddGateway(params *MulticastGroupServiceAddGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddGatewayOK, error)

	MulticastGroupServiceCreate(params *MulticastGroupServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceCreateOK, error)

	MulticastGroupServiceDelete(params *MulticastGroupServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceDeleteOK, error)

	MulticastGroupServiceEnqueue(params *MulticastGroupServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceEnqueueOK, error)

	MulticastGroupServiceFlushQueue(params *MulticastGroupServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceFlushQueueOK, error)

	MulticastGroupServiceGet(params *MulticastGroupServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceGetOK, error)

	MulticastGroupServiceList(params *MulticastGroupServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListOK, error)

	MulticastGroupServiceListQueue(params *MulticastGroupServiceListQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListQueueOK, error)

	MulticastGroupServiceRemoveDevice(params *MulticastGroupServiceRemoveDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveDeviceOK, error)

	MulticastGroupServiceRemoveGateway(params *MulticastGroupServiceRemoveGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveGatewayOK, error)

	MulticastGroupServiceUpdate(params *MulticastGroupServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceUpdateOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
MulticastGroupServiceAddDevice adds a device to the multicast group
*/
func (a *Client) MulticastGroupServiceAddDevice(params *MulticastGroupServiceAddDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddDeviceOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceAddDeviceParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_AddDevice",
		Method:             "POST",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/devices",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceAddDeviceReader{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.(*MulticastGroupServiceAddDeviceOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceAddDeviceDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceAddGateway adds a gateway to the multicast group
*/
func (a *Client) MulticastGroupServiceAddGateway(params *MulticastGroupServiceAddGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceAddGatewayOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceAddGatewayParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_AddGateway",
		Method:             "POST",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/gateways",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceAddGatewayReader{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.(*MulticastGroupServiceAddGatewayOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceAddGatewayDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceCreate creates the given multicast group
*/
func (a *Client) MulticastGroupServiceCreate(params *MulticastGroupServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceCreateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceCreateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_Create",
		Method:             "POST",
		PathPattern:        "/api/multicast-groups",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceCreateReader{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.(*MulticastGroupServiceCreateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceCreateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceDelete deletes the multicast group with the given ID
*/
func (a *Client) MulticastGroupServiceDelete(params *MulticastGroupServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/multicast-groups/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceDeleteReader{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.(*MulticastGroupServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceEnqueue adds the given item to the multicast group queue
*/
func (a *Client) MulticastGroupServiceEnqueue(params *MulticastGroupServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceEnqueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceEnqueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_Enqueue",
		Method:             "POST",
		PathPattern:        "/api/multicast-groups/{queueItem.multicastGroupId}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceEnqueueReader{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.(*MulticastGroupServiceEnqueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceEnqueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceFlushQueue flushes the queue for the given multicast group
*/
func (a *Client) MulticastGroupServiceFlushQueue(params *MulticastGroupServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceFlushQueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceFlushQueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_FlushQueue",
		Method:             "DELETE",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceFlushQueueReader{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.(*MulticastGroupServiceFlushQueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceFlushQueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceGet gets returns the multicast group for the given ID
*/
func (a *Client) MulticastGroupServiceGet(params *MulticastGroupServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_Get",
		Method:             "GET",
		PathPattern:        "/api/multicast-groups/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceGetReader{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.(*MulticastGroupServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceList lists the available multicast groups
*/
func (a *Client) MulticastGroupServiceList(params *MulticastGroupServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_List",
		Method:             "GET",
		PathPattern:        "/api/multicast-groups",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceListReader{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.(*MulticastGroupServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceListQueue lists the items in the multicast group queue
*/
func (a *Client) MulticastGroupServiceListQueue(params *MulticastGroupServiceListQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceListQueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceListQueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_ListQueue",
		Method:             "GET",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceListQueueReader{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.(*MulticastGroupServiceListQueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceListQueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceRemoveDevice removes a device from the multicast group
*/
func (a *Client) MulticastGroupServiceRemoveDevice(params *MulticastGroupServiceRemoveDeviceParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveDeviceOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceRemoveDeviceParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_RemoveDevice",
		Method:             "DELETE",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/devices/{devEui}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceRemoveDeviceReader{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.(*MulticastGroupServiceRemoveDeviceOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceRemoveDeviceDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceRemoveGateway removes a gateway from the multicast group
*/
func (a *Client) MulticastGroupServiceRemoveGateway(params *MulticastGroupServiceRemoveGatewayParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceRemoveGatewayOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceRemoveGatewayParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_RemoveGateway",
		Method:             "DELETE",
		PathPattern:        "/api/multicast-groups/{multicastGroupId}/gateways/{gatewayId}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceRemoveGatewayReader{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.(*MulticastGroupServiceRemoveGatewayOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceRemoveGatewayDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
MulticastGroupServiceUpdate updates the given multicast group
*/
func (a *Client) MulticastGroupServiceUpdate(params *MulticastGroupServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MulticastGroupServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewMulticastGroupServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "MulticastGroupService_Update",
		Method:             "PUT",
		PathPattern:        "/api/multicast-groups/{multicastGroup.id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &MulticastGroupServiceUpdateReader{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.(*MulticastGroupServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*MulticastGroupServiceUpdateDefault)
	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
}
