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

package user

// 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"

	"src.opensuse.org/autogits/common/gitea-generated/models"
)

// NewUserCurrentPostGPGKeyParams creates a new UserCurrentPostGPGKeyParams 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 NewUserCurrentPostGPGKeyParams() *UserCurrentPostGPGKeyParams {
	return &UserCurrentPostGPGKeyParams{
		timeout: cr.DefaultTimeout,
	}
}

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

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

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

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

	for the user current post g p g key operation.

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

	// Form.
	Form *models.CreateGPGKeyOption

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

// WithDefaults hydrates default values in the user current post g p g key params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserCurrentPostGPGKeyParams) WithDefaults() *UserCurrentPostGPGKeyParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the user current post g p g key params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserCurrentPostGPGKeyParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) WithTimeout(timeout time.Duration) *UserCurrentPostGPGKeyParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) WithContext(ctx context.Context) *UserCurrentPostGPGKeyParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) WithHTTPClient(client *http.Client) *UserCurrentPostGPGKeyParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithForm adds the form to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) WithForm(form *models.CreateGPGKeyOption) *UserCurrentPostGPGKeyParams {
	o.SetForm(form)
	return o
}

// SetForm adds the form to the user current post g p g key params
func (o *UserCurrentPostGPGKeyParams) SetForm(form *models.CreateGPGKeyOption) {
	o.Form = form
}

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

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

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