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

package channel

// 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"

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

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

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

/*
CreateChannel creates a new channel
*/
func (a *Client) CreateChannel(params *CreateChannelParams) (*CreateChannelOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreateChannelParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "createChannel",
		Method:             "POST",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &CreateChannelReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*CreateChannelOK), nil

}

/*
CreateChannelRelease adds a release to a channel
*/
func (a *Client) CreateChannelRelease(params *CreateChannelReleaseParams) (*CreateChannelReleaseOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreateChannelReleaseParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "createChannelRelease",
		Method:             "POST",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels/{channel}/{release}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &CreateChannelReleaseReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*CreateChannelReleaseOK), nil

}

/*
DeleteChannel deletes channel
*/
func (a *Client) DeleteChannel(params *DeleteChannelParams) (*DeleteChannelOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteChannelParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "deleteChannel",
		Method:             "DELETE",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels/{channel}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteChannelReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteChannelOK), nil

}

/*
DeleteChannelRelease removes a release from the channel
*/
func (a *Client) DeleteChannelRelease(params *DeleteChannelReleaseParams) (*DeleteChannelReleaseOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteChannelReleaseParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "deleteChannelRelease",
		Method:             "DELETE",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels/{channel}/{release}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteChannelReleaseReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteChannelReleaseOK), nil

}

/*
ListChannels lists channels
*/
func (a *Client) ListChannels(params *ListChannelsParams) (*ListChannelsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewListChannelsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "listChannels",
		Method:             "GET",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ListChannelsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ListChannelsOK), nil

}

/*
ShowChannel shows channel
*/
func (a *Client) ShowChannel(params *ShowChannelParams) (*ShowChannelOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewShowChannelParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "showChannel",
		Method:             "GET",
		PathPattern:        "/api/v1/packages/{namespace}/{package}/channels/{channel}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &ShowChannelReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ShowChannelOK), nil

}

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