package tags

import (
	"github.com/go-openapi/runtime"

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

func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
	return &Client{transport: transport, formats: formats}
}

type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

func (a *Client) AddBuildTag(params *AddBuildTagParams, authInfo runtime.ClientAuthInfoWriter) (*AddBuildTagOK, error) {

	if params == nil {
		params = NewAddBuildTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Build Tag",
		Method:             "PUT",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddBuildTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddBuildTagOK), nil

}

func (a *Client) AddBuildTags(params *AddBuildTagsParams, authInfo runtime.ClientAuthInfoWriter) (*AddBuildTagsOK, error) {

	if params == nil {
		params = NewAddBuildTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Build Tags",
		Method:             "POST",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddBuildTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddBuildTagsOK), nil

}

func (a *Client) AddDefinitionTag(params *AddDefinitionTagParams, authInfo runtime.ClientAuthInfoWriter) (*AddDefinitionTagOK, error) {

	if params == nil {
		params = NewAddDefinitionTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Definition Tag",
		Method:             "PUT",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddDefinitionTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddDefinitionTagOK), nil

}

func (a *Client) AddDefinitionTags(params *AddDefinitionTagsParams, authInfo runtime.ClientAuthInfoWriter) (*AddDefinitionTagsOK, error) {

	if params == nil {
		params = NewAddDefinitionTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Definition Tags",
		Method:             "POST",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddDefinitionTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddDefinitionTagsOK), nil

}

func (a *Client) DeleteBuildTag(params *DeleteBuildTagParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBuildTagOK, error) {

	if params == nil {
		params = NewDeleteBuildTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Delete Build Tag",
		Method:             "DELETE",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteBuildTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteBuildTagOK), nil

}

func (a *Client) DeleteDefinitionTag(params *DeleteDefinitionTagParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteDefinitionTagOK, error) {

	if params == nil {
		params = NewDeleteDefinitionTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Delete Definition Tag",
		Method:             "DELETE",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteDefinitionTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteDefinitionTagOK), nil

}

func (a *Client) GetBuildTags(params *GetBuildTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBuildTagsOK, error) {

	if params == nil {
		params = NewGetBuildTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Build Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetBuildTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetBuildTagsOK), nil

}

func (a *Client) GetDefinitionTags(params *GetDefinitionTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDefinitionTagsOK, error) {

	if params == nil {
		params = NewGetDefinitionTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Definition Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetDefinitionTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetDefinitionTagsOK), nil

}

func (a *Client) GetTags(params *GetTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTagsOK, error) {

	if params == nil {
		params = NewGetTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetTagsOK), nil

}

func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
// Code generated by go-swagger; DO NOT EDIT.

package tags

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

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

/*
AddBuildTag Adds a tag to a build.
*/
func (a *Client) AddBuildTag(params *AddBuildTagParams, authInfo runtime.ClientAuthInfoWriter) (*AddBuildTagOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewAddBuildTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Build Tag",
		Method:             "PUT",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddBuildTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddBuildTagOK), nil

}

/*
AddBuildTags Adds tags to a build.
*/
func (a *Client) AddBuildTags(params *AddBuildTagsParams, authInfo runtime.ClientAuthInfoWriter) (*AddBuildTagsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewAddBuildTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Build Tags",
		Method:             "POST",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddBuildTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddBuildTagsOK), nil

}

/*
AddDefinitionTag Adds a tag to a definition
*/
func (a *Client) AddDefinitionTag(params *AddDefinitionTagParams, authInfo runtime.ClientAuthInfoWriter) (*AddDefinitionTagOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewAddDefinitionTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Definition Tag",
		Method:             "PUT",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddDefinitionTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddDefinitionTagOK), nil

}

/*
AddDefinitionTags Adds multiple tags to a definition.
*/
func (a *Client) AddDefinitionTags(params *AddDefinitionTagsParams, authInfo runtime.ClientAuthInfoWriter) (*AddDefinitionTagsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewAddDefinitionTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Add Definition Tags",
		Method:             "POST",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &AddDefinitionTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddDefinitionTagsOK), nil

}

/*
DeleteBuildTag Removes a tag from a build.
*/
func (a *Client) DeleteBuildTag(params *DeleteBuildTagParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteBuildTagOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteBuildTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Delete Build Tag",
		Method:             "DELETE",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteBuildTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteBuildTagOK), nil

}

/*
DeleteDefinitionTag Removes a tag from a definition.
*/
func (a *Client) DeleteDefinitionTag(params *DeleteDefinitionTagParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteDefinitionTagOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeleteDefinitionTagParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Delete Definition Tag",
		Method:             "DELETE",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags/{tag}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &DeleteDefinitionTagReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*DeleteDefinitionTagOK), nil

}

/*
GetBuildTags Gets the tags for a build.
*/
func (a *Client) GetBuildTags(params *GetBuildTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetBuildTagsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetBuildTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Build Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/builds/{buildId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetBuildTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetBuildTagsOK), nil

}

/*
GetDefinitionTags Gets the tags for a definition.
*/
func (a *Client) GetDefinitionTags(params *GetDefinitionTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetDefinitionTagsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetDefinitionTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Definition Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/definitions/{DefinitionId}/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetDefinitionTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetDefinitionTagsOK), nil

}

/*
GetTags Gets a list of all build and definition tags in the project.
*/
func (a *Client) GetTags(params *GetTagsParams, authInfo runtime.ClientAuthInfoWriter) (*GetTagsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetTagsParams()
	}

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "Get Tags",
		Method:             "GET",
		PathPattern:        "/{organization}/{project}/_apis/build/tags",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{""},
		Schemes:            []string{"https"},
		Params:             params,
		Reader:             &GetTagsReader{formats: a.formats},
		AuthInfo:           authInfo,
		Context:            params.Context,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetTagsOK), nil

}

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