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

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

// New creates a new device 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 device 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 device 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 {
	DeviceServiceActivate(params *DeviceServiceActivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceActivateOK, error)

	DeviceServiceCreate(params *DeviceServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateOK, error)

	DeviceServiceCreateKeys(params *DeviceServiceCreateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateKeysOK, error)

	DeviceServiceDeactivate(params *DeviceServiceDeactivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeactivateOK, error)

	DeviceServiceDelete(params *DeviceServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteOK, error)

	DeviceServiceDeleteKeys(params *DeviceServiceDeleteKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteKeysOK, error)

	DeviceServiceEnqueue(params *DeviceServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceEnqueueOK, error)

	DeviceServiceFlushDevNonces(params *DeviceServiceFlushDevNoncesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushDevNoncesOK, error)

	DeviceServiceFlushQueue(params *DeviceServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushQueueOK, error)

	DeviceServiceGet(params *DeviceServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetOK, error)

	DeviceServiceGetActivation(params *DeviceServiceGetActivationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetActivationOK, error)

	DeviceServiceGetKeys(params *DeviceServiceGetKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetKeysOK, error)

	DeviceServiceGetLinkMetrics(params *DeviceServiceGetLinkMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetLinkMetricsOK, error)

	DeviceServiceGetMetrics(params *DeviceServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetMetricsOK, error)

	DeviceServiceGetNextFCntDown(params *DeviceServiceGetNextFCntDownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetNextFCntDownOK, error)

	DeviceServiceGetQueue(params *DeviceServiceGetQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetQueueOK, error)

	DeviceServiceGetRandomDevAddr(params *DeviceServiceGetRandomDevAddrParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetRandomDevAddrOK, error)

	DeviceServiceList(params *DeviceServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceListOK, error)

	DeviceServiceUpdate(params *DeviceServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateOK, error)

	DeviceServiceUpdateKeys(params *DeviceServiceUpdateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateKeysOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
DeviceServiceActivate activates re activates the device with the given parameters for a b p or for importing o t a a activations
*/
func (a *Client) DeviceServiceActivate(params *DeviceServiceActivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceActivateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceActivateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Activate",
		Method:             "POST",
		PathPattern:        "/api/devices/{deviceActivation.devEui}/activate",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceActivateReader{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.(*DeviceServiceActivateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceActivateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceCreate creates the given device
*/
func (a *Client) DeviceServiceCreate(params *DeviceServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceCreateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Create",
		Method:             "POST",
		PathPattern:        "/api/devices",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceCreateReader{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.(*DeviceServiceCreateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceCreateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceCreateKeys creates the given device keys
*/
func (a *Client) DeviceServiceCreateKeys(params *DeviceServiceCreateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceCreateKeysOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceCreateKeysParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_CreateKeys",
		Method:             "POST",
		PathPattern:        "/api/devices/{deviceKeys.devEui}/keys",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceCreateKeysReader{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.(*DeviceServiceCreateKeysOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceCreateKeysDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceDeactivate deactivates de activates the device
*/
func (a *Client) DeviceServiceDeactivate(params *DeviceServiceDeactivateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeactivateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceDeactivateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Deactivate",
		Method:             "DELETE",
		PathPattern:        "/api/devices/{devEui}/activation",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceDeactivateReader{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.(*DeviceServiceDeactivateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceDeactivateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceDelete deletes the device with the given dev e UI
*/
func (a *Client) DeviceServiceDelete(params *DeviceServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/devices/{devEui}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceDeleteReader{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.(*DeviceServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceDeleteKeys deletes the device keys for the given dev e UI
*/
func (a *Client) DeviceServiceDeleteKeys(params *DeviceServiceDeleteKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceDeleteKeysOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceDeleteKeysParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_DeleteKeys",
		Method:             "DELETE",
		PathPattern:        "/api/devices/{devEui}/keys",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceDeleteKeysReader{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.(*DeviceServiceDeleteKeysOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceDeleteKeysDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceEnqueue enqueues adds the given item to the downlink queue
*/
func (a *Client) DeviceServiceEnqueue(params *DeviceServiceEnqueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceEnqueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceEnqueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Enqueue",
		Method:             "POST",
		PathPattern:        "/api/devices/{queueItem.devEui}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceEnqueueReader{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.(*DeviceServiceEnqueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceEnqueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceFlushDevNonces flushes dev nonces flushes the o t a a device nonces
*/
func (a *Client) DeviceServiceFlushDevNonces(params *DeviceServiceFlushDevNoncesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushDevNoncesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceFlushDevNoncesParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_FlushDevNonces",
		Method:             "DELETE",
		PathPattern:        "/api/devices/{devEui}/dev-nonces",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceFlushDevNoncesReader{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.(*DeviceServiceFlushDevNoncesOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceFlushDevNoncesDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceFlushQueue flushes queue flushes the downlink device queue
*/
func (a *Client) DeviceServiceFlushQueue(params *DeviceServiceFlushQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceFlushQueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceFlushQueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_FlushQueue",
		Method:             "DELETE",
		PathPattern:        "/api/devices/{devEui}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceFlushQueueReader{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.(*DeviceServiceFlushQueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceFlushQueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGet gets returns the device for the given dev e UI
*/
func (a *Client) DeviceServiceGet(params *DeviceServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Get",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetReader{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.(*DeviceServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetActivation gets activation returns the current activation details of the device o t a a or a b p
*/
func (a *Client) DeviceServiceGetActivation(params *DeviceServiceGetActivationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetActivationOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetActivationParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetActivation",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}/activation",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetActivationReader{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.(*DeviceServiceGetActivationOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetActivationDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetKeys gets the device keys for the given dev e UI
*/
func (a *Client) DeviceServiceGetKeys(params *DeviceServiceGetKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetKeysOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetKeysParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetKeys",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}/keys",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetKeysReader{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.(*DeviceServiceGetKeysOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetKeysDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetLinkMetrics gets link metrics returns the device link metrics this includes uplinks downlinks r s s i s n r etc
*/
func (a *Client) DeviceServiceGetLinkMetrics(params *DeviceServiceGetLinkMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetLinkMetricsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetLinkMetricsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetLinkMetrics",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}/link-metrics",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetLinkMetricsReader{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.(*DeviceServiceGetLinkMetricsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetLinkMetricsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetMetrics gets metrics returns the device metrics note that this requires a device profile with codec and measurements configured
*/
func (a *Client) DeviceServiceGetMetrics(params *DeviceServiceGetMetricsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetMetricsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetMetricsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetMetrics",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}/metrics",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetMetricsReader{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.(*DeviceServiceGetMetricsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetMetricsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetNextFCntDown gets next f cnt down returns the next f cnt down to use for enqueing encrypted downlinks the difference with the device activation f cont down is that this method takes potential existing queue items into account
*/
func (a *Client) DeviceServiceGetNextFCntDown(params *DeviceServiceGetNextFCntDownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetNextFCntDownOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetNextFCntDownParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetNextFCntDown",
		Method:             "POST",
		PathPattern:        "/api/devices/{devEui}/get-next-f-cnt-down",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetNextFCntDownReader{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.(*DeviceServiceGetNextFCntDownOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetNextFCntDownDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetQueue gets queue returns the downlink device queue
*/
func (a *Client) DeviceServiceGetQueue(params *DeviceServiceGetQueueParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetQueueOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetQueueParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetQueue",
		Method:             "GET",
		PathPattern:        "/api/devices/{devEui}/queue",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetQueueReader{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.(*DeviceServiceGetQueueOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetQueueDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceGetRandomDevAddr gets random dev addr returns a random dev addr taking the nwk ID prefix into account
*/
func (a *Client) DeviceServiceGetRandomDevAddr(params *DeviceServiceGetRandomDevAddrParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceGetRandomDevAddrOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceGetRandomDevAddrParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_GetRandomDevAddr",
		Method:             "POST",
		PathPattern:        "/api/devices/{devEui}/get-random-dev-addr",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceGetRandomDevAddrReader{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.(*DeviceServiceGetRandomDevAddrOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceGetRandomDevAddrDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceList gets the list of devices
*/
func (a *Client) DeviceServiceList(params *DeviceServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_List",
		Method:             "GET",
		PathPattern:        "/api/devices",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceListReader{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.(*DeviceServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceUpdate updates the given device
*/
func (a *Client) DeviceServiceUpdate(params *DeviceServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_Update",
		Method:             "PUT",
		PathPattern:        "/api/devices/{device.devEui}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceUpdateReader{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.(*DeviceServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceUpdateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceServiceUpdateKeys updates the given device keys
*/
func (a *Client) DeviceServiceUpdateKeys(params *DeviceServiceUpdateKeysParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceServiceUpdateKeysOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceServiceUpdateKeysParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceService_UpdateKeys",
		Method:             "PUT",
		PathPattern:        "/api/devices/{deviceKeys.devEui}/keys",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceServiceUpdateKeysReader{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.(*DeviceServiceUpdateKeysOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceServiceUpdateKeysDefault)
	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
}
