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

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package event_category_assignments

// 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 event category assignments API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

/*
Client for event category assignments 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 {
	CreateEventCategoryAssignment(params *CreateEventCategoryAssignmentParams, opts ...ClientOption) (*CreateEventCategoryAssignmentCreated, error)

	DeleteEventCategoryAssignment(params *DeleteEventCategoryAssignmentParams, opts ...ClientOption) (*DeleteEventCategoryAssignmentNoContent, error)

	GetEventCategoryAssignments(params *GetEventCategoryAssignmentsParams, opts ...ClientOption) (*GetEventCategoryAssignmentsOK, error)

	UpdateEventCategoryAssignment(params *UpdateEventCategoryAssignmentParams, opts ...ClientOption) (*UpdateEventCategoryAssignmentOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
CreateEventCategoryAssignment creates a new event category assignment
*/
func (a *Client) CreateEventCategoryAssignment(params *CreateEventCategoryAssignmentParams, opts ...ClientOption) (*CreateEventCategoryAssignmentCreated, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreateEventCategoryAssignmentParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "createEventCategoryAssignment",
		Method:             "POST",
		PathPattern:        "/eventcategoryassignments",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &CreateEventCategoryAssignmentReader{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.(*CreateEventCategoryAssignmentCreated)
	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 createEventCategoryAssignment: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
DeleteEventCategoryAssignment deletes a event category assignment
*/
func (a *Client) DeleteEventCategoryAssignment(params *DeleteEventCategoryAssignmentParams, opts ...ClientOption) (*DeleteEventCategoryAssignmentNoContent, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteEventCategoryAssignmentParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "deleteEventCategoryAssignment",
		Method:             "DELETE",
		PathPattern:        "/eventcategoryassignments",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &DeleteEventCategoryAssignmentReader{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.(*DeleteEventCategoryAssignmentNoContent)
	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 deleteEventCategoryAssignment: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetEventCategoryAssignments gets a list of event categoryassignments
*/
func (a *Client) GetEventCategoryAssignments(params *GetEventCategoryAssignmentsParams, opts ...ClientOption) (*GetEventCategoryAssignmentsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetEventCategoryAssignmentsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getEventCategoryAssignments",
		Method:             "GET",
		PathPattern:        "/eventcategoryassignments",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetEventCategoryAssignmentsReader{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.(*GetEventCategoryAssignmentsOK)
	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 getEventCategoryAssignments: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
UpdateEventCategoryAssignment updates an existing event category assignment
*/
func (a *Client) UpdateEventCategoryAssignment(params *UpdateEventCategoryAssignmentParams, opts ...ClientOption) (*UpdateEventCategoryAssignmentOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUpdateEventCategoryAssignmentParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "updateEventCategoryAssignment",
		Method:             "PUT",
		PathPattern:        "/eventcategoryassignments",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &UpdateEventCategoryAssignmentReader{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.(*UpdateEventCategoryAssignmentOK)
	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 updateEventCategoryAssignment: 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
}
