// 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" ) // NewUserEmailChangeParams creates a new UserEmailChangeParams 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 NewUserEmailChangeParams() *UserEmailChangeParams { return &UserEmailChangeParams{ timeout: cr.DefaultTimeout, } } // NewUserEmailChangeParamsWithTimeout creates a new UserEmailChangeParams object // with the ability to set a timeout on a request. func NewUserEmailChangeParamsWithTimeout(timeout time.Duration) *UserEmailChangeParams { return &UserEmailChangeParams{ timeout: timeout, } } // NewUserEmailChangeParamsWithContext creates a new UserEmailChangeParams object // with the ability to set a context for a request. func NewUserEmailChangeParamsWithContext(ctx context.Context) *UserEmailChangeParams { return &UserEmailChangeParams{ Context: ctx, } } // NewUserEmailChangeParamsWithHTTPClient creates a new UserEmailChangeParams object // with the ability to set a custom HTTPClient for a request. func NewUserEmailChangeParamsWithHTTPClient(client *http.Client) *UserEmailChangeParams { return &UserEmailChangeParams{ HTTPClient: client, } } /* UserEmailChangeParams contains all the parameters to send to the API endpoint for the user email change operation. Typically these are written to a http.Request. */ type UserEmailChangeParams struct { /* NewEmail. Desired new email address. */ NewEmail string /* Password. User's current password, for verification. */ Password string timeout time.Duration Context context.Context HTTPClient *http.Client } // WithDefaults hydrates default values in the user email change params (not the query body). // // All values with no default are reset to their zero value. func (o *UserEmailChangeParams) WithDefaults() *UserEmailChangeParams { o.SetDefaults() return o } // SetDefaults hydrates default values in the user email change params (not the query body). // // All values with no default are reset to their zero value. func (o *UserEmailChangeParams) SetDefaults() { // no default values defined for this parameter } // WithTimeout adds the timeout to the user email change params func (o *UserEmailChangeParams) WithTimeout(timeout time.Duration) *UserEmailChangeParams { o.SetTimeout(timeout) return o } // SetTimeout adds the timeout to the user email change params func (o *UserEmailChangeParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } // WithContext adds the context to the user email change params func (o *UserEmailChangeParams) WithContext(ctx context.Context) *UserEmailChangeParams { o.SetContext(ctx) return o } // SetContext adds the context to the user email change params func (o *UserEmailChangeParams) SetContext(ctx context.Context) { o.Context = ctx } // WithHTTPClient adds the HTTPClient to the user email change params func (o *UserEmailChangeParams) WithHTTPClient(client *http.Client) *UserEmailChangeParams { o.SetHTTPClient(client) return o } // SetHTTPClient adds the HTTPClient to the user email change params func (o *UserEmailChangeParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } // WithNewEmail adds the newEmail to the user email change params func (o *UserEmailChangeParams) WithNewEmail(newEmail string) *UserEmailChangeParams { o.SetNewEmail(newEmail) return o } // SetNewEmail adds the newEmail to the user email change params func (o *UserEmailChangeParams) SetNewEmail(newEmail string) { o.NewEmail = newEmail } // WithPassword adds the password to the user email change params func (o *UserEmailChangeParams) WithPassword(password string) *UserEmailChangeParams { o.SetPassword(password) return o } // SetPassword adds the password to the user email change params func (o *UserEmailChangeParams) SetPassword(password string) { o.Password = password } // WriteToRequest writes these params to a swagger request func (o *UserEmailChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error // form param new_email frNewEmail := o.NewEmail fNewEmail := frNewEmail if fNewEmail != "" { if err := r.SetFormParam("new_email", fNewEmail); err != nil { return err } } // form param password frPassword := o.Password fPassword := frPassword if fPassword != "" { if err := r.SetFormParam("password", fPassword); err != nil { return err } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil }