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

package content_selectors

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

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

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

// ClientOption is the option for Client methods
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	CreateContentSelector(params *CreateContentSelectorParams, opts ...ClientOption) (*CreateContentSelectorNoContent, error)

	DeleteContentSelector(params *DeleteContentSelectorParams, opts ...ClientOption) (*DeleteContentSelectorNoContent, error)

	GetContentSelector(params *GetContentSelectorParams, opts ...ClientOption) (*GetContentSelectorOK, error)

	GetContentSelectors(params *GetContentSelectorsParams, opts ...ClientOption) (*GetContentSelectorsOK, error)

	UpdateContentSelector(params *UpdateContentSelectorParams, opts ...ClientOption) (*UpdateContentSelectorNoContent, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
CreateContentSelector creates a new content selector
*/
func (a *Client) CreateContentSelector(params *CreateContentSelectorParams, opts ...ClientOption) (*CreateContentSelectorNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreateContentSelectorParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "createContentSelector",
		Method:             "POST",
		PathPattern:        "/v1/security/content-selectors",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &CreateContentSelectorReader{formats: a.formats},
		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.(*CreateContentSelectorNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for createContentSelector: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
DeleteContentSelector deletes a content selector
*/
func (a *Client) DeleteContentSelector(params *DeleteContentSelectorParams, opts ...ClientOption) (*DeleteContentSelectorNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteContentSelectorParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "deleteContentSelector",
		Method:             "DELETE",
		PathPattern:        "/v1/security/content-selectors/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeleteContentSelectorReader{formats: a.formats},
		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.(*DeleteContentSelectorNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for deleteContentSelector: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetContentSelector gets a content selector by name
*/
func (a *Client) GetContentSelector(params *GetContentSelectorParams, opts ...ClientOption) (*GetContentSelectorOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetContentSelectorParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getContentSelector",
		Method:             "GET",
		PathPattern:        "/v1/security/content-selectors/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetContentSelectorReader{formats: a.formats},
		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.(*GetContentSelectorOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getContentSelector: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetContentSelectors lists content selectors
*/
func (a *Client) GetContentSelectors(params *GetContentSelectorsParams, opts ...ClientOption) (*GetContentSelectorsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetContentSelectorsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getContentSelectors",
		Method:             "GET",
		PathPattern:        "/v1/security/content-selectors",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetContentSelectorsReader{formats: a.formats},
		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.(*GetContentSelectorsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for getContentSelectors: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
UpdateContentSelector updates a content selector
*/
func (a *Client) UpdateContentSelector(params *UpdateContentSelectorParams, opts ...ClientOption) (*UpdateContentSelectorNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUpdateContentSelectorParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "updateContentSelector",
		Method:             "PUT",
		PathPattern:        "/v1/security/content-selectors/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateContentSelectorReader{formats: a.formats},
		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.(*UpdateContentSelectorNoContent)
	if ok {
		return success, nil
	}
	// unexpected success response
	// safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue
	msg := fmt.Sprintf("unexpected success response for updateContentSelector: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

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