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

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

// New creates a new device profile 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 profile 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 profile 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 {
	DeviceProfileServiceCreate(params *DeviceProfileServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceCreateOK, error)

	DeviceProfileServiceDelete(params *DeviceProfileServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceDeleteOK, error)

	DeviceProfileServiceGet(params *DeviceProfileServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceGetOK, error)

	DeviceProfileServiceList(params *DeviceProfileServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListOK, error)

	DeviceProfileServiceListAdrAlgorithms(params *DeviceProfileServiceListAdrAlgorithmsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListAdrAlgorithmsOK, error)

	DeviceProfileServiceUpdate(params *DeviceProfileServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceUpdateOK, error)

	SetTransport(transport runtime.ClientTransport)
}

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

/*
DeviceProfileServiceDelete deletes the device profile with the given ID
*/
func (a *Client) DeviceProfileServiceDelete(params *DeviceProfileServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceProfileServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceProfileService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/device-profiles/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceProfileServiceDeleteReader{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.(*DeviceProfileServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceProfileServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceProfileServiceGet gets the device profile for the given ID
*/
func (a *Client) DeviceProfileServiceGet(params *DeviceProfileServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceProfileServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceProfileService_Get",
		Method:             "GET",
		PathPattern:        "/api/device-profiles/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceProfileServiceGetReader{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.(*DeviceProfileServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceProfileServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceProfileServiceList lists the available device profiles
*/
func (a *Client) DeviceProfileServiceList(params *DeviceProfileServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceProfileServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceProfileService_List",
		Method:             "GET",
		PathPattern:        "/api/device-profiles",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceProfileServiceListReader{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.(*DeviceProfileServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceProfileServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceProfileServiceListAdrAlgorithms lists available a d r algorithms
*/
func (a *Client) DeviceProfileServiceListAdrAlgorithms(params *DeviceProfileServiceListAdrAlgorithmsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceListAdrAlgorithmsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceProfileServiceListAdrAlgorithmsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceProfileService_ListAdrAlgorithms",
		Method:             "GET",
		PathPattern:        "/api/device-profiles/adr-algorithms",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceProfileServiceListAdrAlgorithmsReader{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.(*DeviceProfileServiceListAdrAlgorithmsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceProfileServiceListAdrAlgorithmsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
DeviceProfileServiceUpdate updates the given device profile
*/
func (a *Client) DeviceProfileServiceUpdate(params *DeviceProfileServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DeviceProfileServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeviceProfileServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "DeviceProfileService_Update",
		Method:             "PUT",
		PathPattern:        "/api/device-profiles/{deviceProfile.id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &DeviceProfileServiceUpdateReader{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.(*DeviceProfileServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*DeviceProfileServiceUpdateDefault)
	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
}
