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

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 (
	"io"

	"github.com/go-openapi/runtime"

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

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

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

/*
PullPackage downloads the package
*/
func (a *Client) PullPackage(params *PullPackageParams, writer io.Writer) (*PullPackageOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPullPackageParams()
	}

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

}

/*
PullPackageJSON downloads the package
*/
func (a *Client) PullPackageJSON(params *PullPackageJSONParams) (*PullPackageJSONOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPullPackageJSONParams()
	}

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

}

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