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

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

// New creates a new recurring run 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 recurring run 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 recurring run 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 {
	RecurringRunServiceCreateRecurringRun(params *RecurringRunServiceCreateRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceCreateRecurringRunOK, error)

	RecurringRunServiceDeleteRecurringRun(params *RecurringRunServiceDeleteRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceDeleteRecurringRunOK, error)

	RecurringRunServiceDisableRecurringRun(params *RecurringRunServiceDisableRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceDisableRecurringRunOK, error)

	RecurringRunServiceEnableRecurringRun(params *RecurringRunServiceEnableRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceEnableRecurringRunOK, error)

	RecurringRunServiceGetRecurringRun(params *RecurringRunServiceGetRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceGetRecurringRunOK, error)

	RecurringRunServiceListRecurringRuns(params *RecurringRunServiceListRecurringRunsParams, opts ...ClientOption) (*RecurringRunServiceListRecurringRunsOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
RecurringRunServiceCreateRecurringRun creates a new recurring run in an experiment given the experiment ID
*/
func (a *Client) RecurringRunServiceCreateRecurringRun(params *RecurringRunServiceCreateRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceCreateRecurringRunOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceCreateRecurringRunParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_CreateRecurringRun",
		Method:             "POST",
		PathPattern:        "/apis/v2beta1/recurringruns",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceCreateRecurringRunReader{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.(*RecurringRunServiceCreateRecurringRunOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceCreateRecurringRunDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RecurringRunServiceDeleteRecurringRun deletes a recurring run
*/
func (a *Client) RecurringRunServiceDeleteRecurringRun(params *RecurringRunServiceDeleteRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceDeleteRecurringRunOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceDeleteRecurringRunParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_DeleteRecurringRun",
		Method:             "DELETE",
		PathPattern:        "/apis/v2beta1/recurringruns/{recurring_run_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceDeleteRecurringRunReader{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.(*RecurringRunServiceDeleteRecurringRunOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceDeleteRecurringRunDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RecurringRunServiceDisableRecurringRun stops a recurring run and all its associated runs the recurring run is not deleted
*/
func (a *Client) RecurringRunServiceDisableRecurringRun(params *RecurringRunServiceDisableRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceDisableRecurringRunOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceDisableRecurringRunParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_DisableRecurringRun",
		Method:             "POST",
		PathPattern:        "/apis/v2beta1/recurringruns/{recurring_run_id}:disable",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceDisableRecurringRunReader{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.(*RecurringRunServiceDisableRecurringRunOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceDisableRecurringRunDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RecurringRunServiceEnableRecurringRun restarts a recurring run that was previously stopped all runs associated with the recurring run will continue
*/
func (a *Client) RecurringRunServiceEnableRecurringRun(params *RecurringRunServiceEnableRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceEnableRecurringRunOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceEnableRecurringRunParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_EnableRecurringRun",
		Method:             "POST",
		PathPattern:        "/apis/v2beta1/recurringruns/{recurring_run_id}:enable",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceEnableRecurringRunReader{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.(*RecurringRunServiceEnableRecurringRunOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceEnableRecurringRunDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RecurringRunServiceGetRecurringRun finds a specific recurring run by ID
*/
func (a *Client) RecurringRunServiceGetRecurringRun(params *RecurringRunServiceGetRecurringRunParams, opts ...ClientOption) (*RecurringRunServiceGetRecurringRunOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceGetRecurringRunParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_GetRecurringRun",
		Method:             "GET",
		PathPattern:        "/apis/v2beta1/recurringruns/{recurring_run_id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceGetRecurringRunReader{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.(*RecurringRunServiceGetRecurringRunOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceGetRecurringRunDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RecurringRunServiceListRecurringRuns finds all recurring runs given experiment and namespace if experiment ID is not specified find all recurring runs across all experiments
*/
func (a *Client) RecurringRunServiceListRecurringRuns(params *RecurringRunServiceListRecurringRunsParams, opts ...ClientOption) (*RecurringRunServiceListRecurringRunsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRecurringRunServiceListRecurringRunsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RecurringRunService_ListRecurringRuns",
		Method:             "GET",
		PathPattern:        "/apis/v2beta1/recurringruns",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RecurringRunServiceListRecurringRunsReader{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.(*RecurringRunServiceListRecurringRunsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RecurringRunServiceListRecurringRunsDefault)
	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
}
