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

package package_appr

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

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

/*
CreatePackage pushes new package release to the registry
*/
func (a *Client) CreatePackage(params *CreatePackageParams) (*CreatePackageOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewCreatePackageParams()
	}

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

}

/*
DeletePackage deletes a package release
*/
func (a *Client) DeletePackage(params *DeletePackageParams) (*DeletePackageOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewDeletePackageParams()
	}

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

}

/*
ListPackages lists packages
*/
func (a *Client) ListPackages(params *ListPackagesParams) (*ListPackagesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewListPackagesParams()
	}

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

}

/*
ShowPackage shows a package
*/
func (a *Client) ShowPackage(params *ShowPackageParams) (*ShowPackageOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewShowPackageParams()
	}

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

}

/*
ShowPackageManifests lists all manifests for a package
*/
func (a *Client) ShowPackageManifests(params *ShowPackageManifestsParams) (*ShowPackageManifestsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewShowPackageManifestsParams()
	}

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

}

/*
ShowPackageReleases lists all releases for a package
*/
func (a *Client) ShowPackageReleases(params *ShowPackageReleasesParams) (*ShowPackageReleasesOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewShowPackageReleasesParams()
	}

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

}

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