github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/verify_email_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package users
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  )
    18  
    19  // NewVerifyEmailParams creates a new VerifyEmailParams object,
    20  // with the default timeout for this client.
    21  //
    22  // Default values are not hydrated, since defaults are normally applied by the API server side.
    23  //
    24  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    25  func NewVerifyEmailParams() *VerifyEmailParams {
    26  	return &VerifyEmailParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewVerifyEmailParamsWithTimeout creates a new VerifyEmailParams object
    32  // with the ability to set a timeout on a request.
    33  func NewVerifyEmailParamsWithTimeout(timeout time.Duration) *VerifyEmailParams {
    34  	return &VerifyEmailParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewVerifyEmailParamsWithContext creates a new VerifyEmailParams object
    40  // with the ability to set a context for a request.
    41  func NewVerifyEmailParamsWithContext(ctx context.Context) *VerifyEmailParams {
    42  	return &VerifyEmailParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewVerifyEmailParamsWithHTTPClient creates a new VerifyEmailParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewVerifyEmailParamsWithHTTPClient(client *http.Client) *VerifyEmailParams {
    50  	return &VerifyEmailParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /* VerifyEmailParams contains all the parameters to send to the API endpoint
    56     for the verify email operation.
    57  
    58     Typically these are written to a http.Request.
    59  */
    60  type VerifyEmailParams struct {
    61  
    62  	/* Email.
    63  
    64  	   email address to change
    65  	*/
    66  	Email string
    67  
    68  	/* Username.
    69  
    70  	   username of desired User
    71  	*/
    72  	Username string
    73  
    74  	/* VerifyCode.
    75  
    76  	   verification code for email
    77  	*/
    78  	VerifyCode string
    79  
    80  	timeout    time.Duration
    81  	Context    context.Context
    82  	HTTPClient *http.Client
    83  }
    84  
    85  // WithDefaults hydrates default values in the verify email params (not the query body).
    86  //
    87  // All values with no default are reset to their zero value.
    88  func (o *VerifyEmailParams) WithDefaults() *VerifyEmailParams {
    89  	o.SetDefaults()
    90  	return o
    91  }
    92  
    93  // SetDefaults hydrates default values in the verify email params (not the query body).
    94  //
    95  // All values with no default are reset to their zero value.
    96  func (o *VerifyEmailParams) SetDefaults() {
    97  	// no default values defined for this parameter
    98  }
    99  
   100  // WithTimeout adds the timeout to the verify email params
   101  func (o *VerifyEmailParams) WithTimeout(timeout time.Duration) *VerifyEmailParams {
   102  	o.SetTimeout(timeout)
   103  	return o
   104  }
   105  
   106  // SetTimeout adds the timeout to the verify email params
   107  func (o *VerifyEmailParams) SetTimeout(timeout time.Duration) {
   108  	o.timeout = timeout
   109  }
   110  
   111  // WithContext adds the context to the verify email params
   112  func (o *VerifyEmailParams) WithContext(ctx context.Context) *VerifyEmailParams {
   113  	o.SetContext(ctx)
   114  	return o
   115  }
   116  
   117  // SetContext adds the context to the verify email params
   118  func (o *VerifyEmailParams) SetContext(ctx context.Context) {
   119  	o.Context = ctx
   120  }
   121  
   122  // WithHTTPClient adds the HTTPClient to the verify email params
   123  func (o *VerifyEmailParams) WithHTTPClient(client *http.Client) *VerifyEmailParams {
   124  	o.SetHTTPClient(client)
   125  	return o
   126  }
   127  
   128  // SetHTTPClient adds the HTTPClient to the verify email params
   129  func (o *VerifyEmailParams) SetHTTPClient(client *http.Client) {
   130  	o.HTTPClient = client
   131  }
   132  
   133  // WithEmail adds the email to the verify email params
   134  func (o *VerifyEmailParams) WithEmail(email string) *VerifyEmailParams {
   135  	o.SetEmail(email)
   136  	return o
   137  }
   138  
   139  // SetEmail adds the email to the verify email params
   140  func (o *VerifyEmailParams) SetEmail(email string) {
   141  	o.Email = email
   142  }
   143  
   144  // WithUsername adds the username to the verify email params
   145  func (o *VerifyEmailParams) WithUsername(username string) *VerifyEmailParams {
   146  	o.SetUsername(username)
   147  	return o
   148  }
   149  
   150  // SetUsername adds the username to the verify email params
   151  func (o *VerifyEmailParams) SetUsername(username string) {
   152  	o.Username = username
   153  }
   154  
   155  // WithVerifyCode adds the verifyCode to the verify email params
   156  func (o *VerifyEmailParams) WithVerifyCode(verifyCode string) *VerifyEmailParams {
   157  	o.SetVerifyCode(verifyCode)
   158  	return o
   159  }
   160  
   161  // SetVerifyCode adds the verifyCode to the verify email params
   162  func (o *VerifyEmailParams) SetVerifyCode(verifyCode string) {
   163  	o.VerifyCode = verifyCode
   164  }
   165  
   166  // WriteToRequest writes these params to a swagger request
   167  func (o *VerifyEmailParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   168  
   169  	if err := r.SetTimeout(o.timeout); err != nil {
   170  		return err
   171  	}
   172  	var res []error
   173  
   174  	// path param email
   175  	if err := r.SetPathParam("email", o.Email); err != nil {
   176  		return err
   177  	}
   178  
   179  	// path param username
   180  	if err := r.SetPathParam("username", o.Username); err != nil {
   181  		return err
   182  	}
   183  
   184  	// query param verifyCode
   185  	qrVerifyCode := o.VerifyCode
   186  	qVerifyCode := qrVerifyCode
   187  	if qVerifyCode != "" {
   188  
   189  		if err := r.SetQueryParam("verifyCode", qVerifyCode); err != nil {
   190  			return err
   191  		}
   192  	}
   193  
   194  	if len(res) > 0 {
   195  		return errors.CompositeValidationError(res...)
   196  	}
   197  	return nil
   198  }