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

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

// New creates a new user 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 user 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 user 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 {
	UserServiceCreate(params *UserServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceCreateOK, error)

	UserServiceDelete(params *UserServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceDeleteOK, error)

	UserServiceGet(params *UserServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceGetOK, error)

	UserServiceList(params *UserServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceListOK, error)

	UserServiceUpdate(params *UserServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdateOK, error)

	UserServiceUpdatePassword(params *UserServiceUpdatePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdatePasswordOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
UserServiceCreate creates a new user
*/
func (a *Client) UserServiceCreate(params *UserServiceCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceCreateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceCreateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_Create",
		Method:             "POST",
		PathPattern:        "/api/users",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceCreateReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceCreateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceCreateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UserServiceDelete deletes the user with the given ID
*/
func (a *Client) UserServiceDelete(params *UserServiceDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceDeleteOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceDeleteParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_Delete",
		Method:             "DELETE",
		PathPattern:        "/api/users/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceDeleteReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceDeleteOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceDeleteDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UserServiceGet gets the user for the given ID
*/
func (a *Client) UserServiceGet(params *UserServiceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceGetOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceGetParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_Get",
		Method:             "GET",
		PathPattern:        "/api/users/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceGetReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceGetOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceGetDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UserServiceList gets the list of users
*/
func (a *Client) UserServiceList(params *UserServiceListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceListOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceListParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_List",
		Method:             "GET",
		PathPattern:        "/api/users",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceListReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceListOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceListDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UserServiceUpdate updates the given user
*/
func (a *Client) UserServiceUpdate(params *UserServiceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdateOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceUpdateParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_Update",
		Method:             "PUT",
		PathPattern:        "/api/users/{user.id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceUpdateReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceUpdateOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceUpdateDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
UserServiceUpdatePassword updates the password for the given user
*/
func (a *Client) UserServiceUpdatePassword(params *UserServiceUpdatePasswordParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserServiceUpdatePasswordOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewUserServiceUpdatePasswordParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "UserService_UpdatePassword",
		Method:             "POST",
		PathPattern:        "/api/users/{userId}/password",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UserServiceUpdatePasswordReader{formats: a.formats},
		AuthInfo:           authInfo,
		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.(*UserServiceUpdatePasswordOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*UserServiceUpdatePasswordDefault)
	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
}
