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

package miscellaneous

// 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"
	httptransport "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
)

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

// New creates a new miscellaneous 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 miscellaneous 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 miscellaneous 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)

// This client is generated with a few options you might find useful for your swagger spec.
//
// Feel free to add you own set of options.

// WithContentType allows the client to force the Content-Type header
// to negotiate a specific Consumer from the server.
//
// You may use this option to set arbitrary extensions to your MIME media type.
func WithContentType(mime string) ClientOption {
	return func(r *runtime.ClientOperation) {
		r.ConsumesMediaTypes = []string{mime}
	}
}

// WithContentTypeApplicationJSON sets the Content-Type header to "application/json".
func WithContentTypeApplicationJSON(r *runtime.ClientOperation) {
	r.ConsumesMediaTypes = []string{"application/json"}
}

// WithContentTypeTextPlain sets the Content-Type header to "text/plain".
func WithContentTypeTextPlain(r *runtime.ClientOperation) {
	r.ConsumesMediaTypes = []string{"text/plain"}
}

// WithAccept allows the client to force the Accept header
// to negotiate a specific Producer from the server.
//
// You may use this option to set arbitrary extensions to your MIME media type.
func WithAccept(mime string) ClientOption {
	return func(r *runtime.ClientOperation) {
		r.ProducesMediaTypes = []string{mime}
	}
}

// WithAcceptApplicationJSON sets the Accept header to "application/json".
func WithAcceptApplicationJSON(r *runtime.ClientOperation) {
	r.ProducesMediaTypes = []string{"application/json"}
}

// WithAcceptTextHTML sets the Accept header to "text/html".
func WithAcceptTextHTML(r *runtime.ClientOperation) {
	r.ProducesMediaTypes = []string{"text/html"}
}

// WithAcceptTextPlain sets the Accept header to "text/plain".
func WithAcceptTextPlain(r *runtime.ClientOperation) {
	r.ProducesMediaTypes = []string{"text/plain"}
}

// ClientService is the interface for Client methods
type ClientService interface {
	GetGitignoreTemplateInfo(params *GetGitignoreTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGitignoreTemplateInfoOK, error)

	GetLabelTemplateInfo(params *GetLabelTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabelTemplateInfoOK, error)

	GetLicenseTemplateInfo(params *GetLicenseTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTemplateInfoOK, error)

	GetNodeInfo(params *GetNodeInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNodeInfoOK, error)

	GetSigningKey(params *GetSigningKeyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSigningKeyOK, error)

	GetVersion(params *GetVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVersionOK, error)

	ListGitignoresTemplates(params *ListGitignoresTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListGitignoresTemplatesOK, error)

	ListLabelTemplates(params *ListLabelTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListLabelTemplatesOK, error)

	ListLicenseTemplates(params *ListLicenseTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListLicenseTemplatesOK, error)

	RenderMarkdown(params *RenderMarkdownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkdownOK, error)

	RenderMarkdownRaw(params *RenderMarkdownRawParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkdownRawOK, error)

	RenderMarkup(params *RenderMarkupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkupOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
GetGitignoreTemplateInfo returns information about a gitignore template
*/
func (a *Client) GetGitignoreTemplateInfo(params *GetGitignoreTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetGitignoreTemplateInfoOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetGitignoreTemplateInfoParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getGitignoreTemplateInfo",
		Method:             "GET",
		PathPattern:        "/gitignore/templates/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetGitignoreTemplateInfoReader{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.(*GetGitignoreTemplateInfoOK)
	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 getGitignoreTemplateInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetLabelTemplateInfo returns all labels in a template
*/
func (a *Client) GetLabelTemplateInfo(params *GetLabelTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLabelTemplateInfoOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLabelTemplateInfoParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getLabelTemplateInfo",
		Method:             "GET",
		PathPattern:        "/label/templates/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetLabelTemplateInfoReader{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.(*GetLabelTemplateInfoOK)
	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 getLabelTemplateInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetLicenseTemplateInfo returns information about a license template
*/
func (a *Client) GetLicenseTemplateInfo(params *GetLicenseTemplateInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetLicenseTemplateInfoOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetLicenseTemplateInfoParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getLicenseTemplateInfo",
		Method:             "GET",
		PathPattern:        "/licenses/{name}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetLicenseTemplateInfoReader{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.(*GetLicenseTemplateInfoOK)
	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 getLicenseTemplateInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetNodeInfo returns the nodeinfo of the gitea application
*/
func (a *Client) GetNodeInfo(params *GetNodeInfoParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetNodeInfoOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetNodeInfoParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getNodeInfo",
		Method:             "GET",
		PathPattern:        "/nodeinfo",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetNodeInfoReader{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.(*GetNodeInfoOK)
	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 getNodeInfo: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetSigningKey gets default signing key gpg
*/
func (a *Client) GetSigningKey(params *GetSigningKeyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetSigningKeyOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetSigningKeyParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getSigningKey",
		Method:             "GET",
		PathPattern:        "/signing-key.gpg",
		ProducesMediaTypes: []string{"text/plain"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetSigningKeyReader{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.(*GetSigningKeyOK)
	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 getSigningKey: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
GetVersion returns the version of the gitea application
*/
func (a *Client) GetVersion(params *GetVersionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetVersionOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetVersionParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "getVersion",
		Method:             "GET",
		PathPattern:        "/version",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetVersionReader{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.(*GetVersionOK)
	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 getVersion: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
ListGitignoresTemplates returns a list of all gitignore templates
*/
func (a *Client) ListGitignoresTemplates(params *ListGitignoresTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListGitignoresTemplatesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewListGitignoresTemplatesParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "listGitignoresTemplates",
		Method:             "GET",
		PathPattern:        "/gitignore/templates",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &ListGitignoresTemplatesReader{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.(*ListGitignoresTemplatesOK)
	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 listGitignoresTemplates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
ListLabelTemplates returns a list of all label templates
*/
func (a *Client) ListLabelTemplates(params *ListLabelTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListLabelTemplatesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewListLabelTemplatesParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "listLabelTemplates",
		Method:             "GET",
		PathPattern:        "/label/templates",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &ListLabelTemplatesReader{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.(*ListLabelTemplatesOK)
	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 listLabelTemplates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
ListLicenseTemplates returns a list of all license templates
*/
func (a *Client) ListLicenseTemplates(params *ListLicenseTemplatesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListLicenseTemplatesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewListLicenseTemplatesParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "listLicenseTemplates",
		Method:             "GET",
		PathPattern:        "/licenses",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json", "text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &ListLicenseTemplatesReader{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.(*ListLicenseTemplatesOK)
	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 listLicenseTemplates: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
RenderMarkdown renders a markdown document as HTML
*/
func (a *Client) RenderMarkdown(params *RenderMarkdownParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkdownOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRenderMarkdownParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "renderMarkdown",
		Method:             "POST",
		PathPattern:        "/markdown",
		ProducesMediaTypes: []string{"text/html"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RenderMarkdownReader{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.(*RenderMarkdownOK)
	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 renderMarkdown: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
RenderMarkdownRaw renders raw markdown as HTML
*/
func (a *Client) RenderMarkdownRaw(params *RenderMarkdownRawParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkdownRawOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRenderMarkdownRawParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "renderMarkdownRaw",
		Method:             "POST",
		PathPattern:        "/markdown/raw",
		ProducesMediaTypes: []string{"text/html"},
		ConsumesMediaTypes: []string{"text/plain"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RenderMarkdownRawReader{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.(*RenderMarkdownRawOK)
	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 renderMarkdownRaw: API contract not enforced by server. Client expected to get an error, but got: %T", result)
	panic(msg)
}

/*
RenderMarkup renders a markup document as HTML
*/
func (a *Client) RenderMarkup(params *RenderMarkupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RenderMarkupOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRenderMarkupParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "renderMarkup",
		Method:             "POST",
		PathPattern:        "/markup",
		ProducesMediaTypes: []string{"text/html"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &RenderMarkupReader{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.(*RenderMarkupOK)
	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 renderMarkup: 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
}
