gtslib/client/user/user_password_change_parameters.go
decentral1se e4ade9c758
All checks were successful
continuous-integration/drone/push Build is passing
feat: init
2024-07-31 22:47:18 +02:00

184 lines
5.3 KiB
Go

// 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"
)
// NewUserPasswordChangeParams creates a new UserPasswordChangeParams 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 NewUserPasswordChangeParams() *UserPasswordChangeParams {
return &UserPasswordChangeParams{
timeout: cr.DefaultTimeout,
}
}
// NewUserPasswordChangeParamsWithTimeout creates a new UserPasswordChangeParams object
// with the ability to set a timeout on a request.
func NewUserPasswordChangeParamsWithTimeout(timeout time.Duration) *UserPasswordChangeParams {
return &UserPasswordChangeParams{
timeout: timeout,
}
}
// NewUserPasswordChangeParamsWithContext creates a new UserPasswordChangeParams object
// with the ability to set a context for a request.
func NewUserPasswordChangeParamsWithContext(ctx context.Context) *UserPasswordChangeParams {
return &UserPasswordChangeParams{
Context: ctx,
}
}
// NewUserPasswordChangeParamsWithHTTPClient creates a new UserPasswordChangeParams object
// with the ability to set a custom HTTPClient for a request.
func NewUserPasswordChangeParamsWithHTTPClient(client *http.Client) *UserPasswordChangeParams {
return &UserPasswordChangeParams{
HTTPClient: client,
}
}
/*
UserPasswordChangeParams contains all the parameters to send to the API endpoint
for the user password change operation.
Typically these are written to a http.Request.
*/
type UserPasswordChangeParams struct {
/* NewPassword.
Desired new password.
If the password does not have high enough entropy, it will be rejected.
See https://github.com/wagslane/go-password-validator
*/
NewPassword string
/* OldPassword.
User's previous password.
*/
OldPassword string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the user password change params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserPasswordChangeParams) WithDefaults() *UserPasswordChangeParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the user password change params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserPasswordChangeParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the user password change params
func (o *UserPasswordChangeParams) WithTimeout(timeout time.Duration) *UserPasswordChangeParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the user password change params
func (o *UserPasswordChangeParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the user password change params
func (o *UserPasswordChangeParams) WithContext(ctx context.Context) *UserPasswordChangeParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the user password change params
func (o *UserPasswordChangeParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the user password change params
func (o *UserPasswordChangeParams) WithHTTPClient(client *http.Client) *UserPasswordChangeParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the user password change params
func (o *UserPasswordChangeParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithNewPassword adds the newPassword to the user password change params
func (o *UserPasswordChangeParams) WithNewPassword(newPassword string) *UserPasswordChangeParams {
o.SetNewPassword(newPassword)
return o
}
// SetNewPassword adds the newPassword to the user password change params
func (o *UserPasswordChangeParams) SetNewPassword(newPassword string) {
o.NewPassword = newPassword
}
// WithOldPassword adds the oldPassword to the user password change params
func (o *UserPasswordChangeParams) WithOldPassword(oldPassword string) *UserPasswordChangeParams {
o.SetOldPassword(oldPassword)
return o
}
// SetOldPassword adds the oldPassword to the user password change params
func (o *UserPasswordChangeParams) SetOldPassword(oldPassword string) {
o.OldPassword = oldPassword
}
// WriteToRequest writes these params to a swagger request
func (o *UserPasswordChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// form param new_password
frNewPassword := o.NewPassword
fNewPassword := frNewPassword
if fNewPassword != "" {
if err := r.SetFormParam("new_password", fNewPassword); err != nil {
return err
}
}
// form param old_password
frOldPassword := o.OldPassword
fOldPassword := frOldPassword
if fOldPassword != "" {
if err := r.SetFormParam("old_password", fOldPassword); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}