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

package repository

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"context"
	"net/http"
	"time"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/strfmt"
)

// NewRepoDownloadCommitDiffOrPatchParams creates a new RepoDownloadCommitDiffOrPatchParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewRepoDownloadCommitDiffOrPatchParams() *RepoDownloadCommitDiffOrPatchParams {
	return &RepoDownloadCommitDiffOrPatchParams{
		timeout: cr.DefaultTimeout,
	}
}

// NewRepoDownloadCommitDiffOrPatchParamsWithTimeout creates a new RepoDownloadCommitDiffOrPatchParams object
// with the ability to set a timeout on a request.
func NewRepoDownloadCommitDiffOrPatchParamsWithTimeout(timeout time.Duration) *RepoDownloadCommitDiffOrPatchParams {
	return &RepoDownloadCommitDiffOrPatchParams{
		timeout: timeout,
	}
}

// NewRepoDownloadCommitDiffOrPatchParamsWithContext creates a new RepoDownloadCommitDiffOrPatchParams object
// with the ability to set a context for a request.
func NewRepoDownloadCommitDiffOrPatchParamsWithContext(ctx context.Context) *RepoDownloadCommitDiffOrPatchParams {
	return &RepoDownloadCommitDiffOrPatchParams{
		Context: ctx,
	}
}

// NewRepoDownloadCommitDiffOrPatchParamsWithHTTPClient creates a new RepoDownloadCommitDiffOrPatchParams object
// with the ability to set a custom HTTPClient for a request.
func NewRepoDownloadCommitDiffOrPatchParamsWithHTTPClient(client *http.Client) *RepoDownloadCommitDiffOrPatchParams {
	return &RepoDownloadCommitDiffOrPatchParams{
		HTTPClient: client,
	}
}

/*
RepoDownloadCommitDiffOrPatchParams contains all the parameters to send to the API endpoint

	for the repo download commit diff or patch operation.

	Typically these are written to a http.Request.
*/
type RepoDownloadCommitDiffOrPatchParams struct {

	/* DiffType.

	   whether the output is diff or patch
	*/
	DiffType string

	/* Owner.

	   owner of the repo
	*/
	Owner string

	/* Repo.

	   name of the repo
	*/
	Repo string

	/* Sha.

	   SHA of the commit to get
	*/
	Sha string

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

// WithDefaults hydrates default values in the repo download commit diff or patch params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RepoDownloadCommitDiffOrPatchParams) WithDefaults() *RepoDownloadCommitDiffOrPatchParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the repo download commit diff or patch params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *RepoDownloadCommitDiffOrPatchParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithTimeout(timeout time.Duration) *RepoDownloadCommitDiffOrPatchParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithContext(ctx context.Context) *RepoDownloadCommitDiffOrPatchParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithHTTPClient(client *http.Client) *RepoDownloadCommitDiffOrPatchParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithDiffType adds the diffType to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithDiffType(diffType string) *RepoDownloadCommitDiffOrPatchParams {
	o.SetDiffType(diffType)
	return o
}

// SetDiffType adds the diffType to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetDiffType(diffType string) {
	o.DiffType = diffType
}

// WithOwner adds the owner to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithOwner(owner string) *RepoDownloadCommitDiffOrPatchParams {
	o.SetOwner(owner)
	return o
}

// SetOwner adds the owner to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetOwner(owner string) {
	o.Owner = owner
}

// WithRepo adds the repo to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithRepo(repo string) *RepoDownloadCommitDiffOrPatchParams {
	o.SetRepo(repo)
	return o
}

// SetRepo adds the repo to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetRepo(repo string) {
	o.Repo = repo
}

// WithSha adds the sha to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) WithSha(sha string) *RepoDownloadCommitDiffOrPatchParams {
	o.SetSha(sha)
	return o
}

// SetSha adds the sha to the repo download commit diff or patch params
func (o *RepoDownloadCommitDiffOrPatchParams) SetSha(sha string) {
	o.Sha = sha
}

// WriteToRequest writes these params to a swagger request
func (o *RepoDownloadCommitDiffOrPatchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	// path param diffType
	if err := r.SetPathParam("diffType", o.DiffType); err != nil {
		return err
	}

	// path param owner
	if err := r.SetPathParam("owner", o.Owner); err != nil {
		return err
	}

	// path param repo
	if err := r.SetPathParam("repo", o.Repo); err != nil {
		return err
	}

	// path param sha
	if err := r.SetPathParam("sha", o.Sha); err != nil {
		return err
	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
