github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/add_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 // NewAddEmailParams creates a new AddEmailParams 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 NewAddEmailParams() *AddEmailParams { 26 return &AddEmailParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewAddEmailParamsWithTimeout creates a new AddEmailParams object 32 // with the ability to set a timeout on a request. 33 func NewAddEmailParamsWithTimeout(timeout time.Duration) *AddEmailParams { 34 return &AddEmailParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewAddEmailParamsWithContext creates a new AddEmailParams object 40 // with the ability to set a context for a request. 41 func NewAddEmailParamsWithContext(ctx context.Context) *AddEmailParams { 42 return &AddEmailParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewAddEmailParamsWithHTTPClient creates a new AddEmailParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewAddEmailParamsWithHTTPClient(client *http.Client) *AddEmailParams { 50 return &AddEmailParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* AddEmailParams contains all the parameters to send to the API endpoint 56 for the add email operation. 57 58 Typically these are written to a http.Request. 59 */ 60 type AddEmailParams struct { 61 62 /* Email. 63 64 Email to add 65 */ 66 Email AddEmailBody 67 68 /* Username. 69 70 username of desired User 71 */ 72 Username string 73 74 timeout time.Duration 75 Context context.Context 76 HTTPClient *http.Client 77 } 78 79 // WithDefaults hydrates default values in the add email params (not the query body). 80 // 81 // All values with no default are reset to their zero value. 82 func (o *AddEmailParams) WithDefaults() *AddEmailParams { 83 o.SetDefaults() 84 return o 85 } 86 87 // SetDefaults hydrates default values in the add email params (not the query body). 88 // 89 // All values with no default are reset to their zero value. 90 func (o *AddEmailParams) SetDefaults() { 91 // no default values defined for this parameter 92 } 93 94 // WithTimeout adds the timeout to the add email params 95 func (o *AddEmailParams) WithTimeout(timeout time.Duration) *AddEmailParams { 96 o.SetTimeout(timeout) 97 return o 98 } 99 100 // SetTimeout adds the timeout to the add email params 101 func (o *AddEmailParams) SetTimeout(timeout time.Duration) { 102 o.timeout = timeout 103 } 104 105 // WithContext adds the context to the add email params 106 func (o *AddEmailParams) WithContext(ctx context.Context) *AddEmailParams { 107 o.SetContext(ctx) 108 return o 109 } 110 111 // SetContext adds the context to the add email params 112 func (o *AddEmailParams) SetContext(ctx context.Context) { 113 o.Context = ctx 114 } 115 116 // WithHTTPClient adds the HTTPClient to the add email params 117 func (o *AddEmailParams) WithHTTPClient(client *http.Client) *AddEmailParams { 118 o.SetHTTPClient(client) 119 return o 120 } 121 122 // SetHTTPClient adds the HTTPClient to the add email params 123 func (o *AddEmailParams) SetHTTPClient(client *http.Client) { 124 o.HTTPClient = client 125 } 126 127 // WithEmail adds the email to the add email params 128 func (o *AddEmailParams) WithEmail(email AddEmailBody) *AddEmailParams { 129 o.SetEmail(email) 130 return o 131 } 132 133 // SetEmail adds the email to the add email params 134 func (o *AddEmailParams) SetEmail(email AddEmailBody) { 135 o.Email = email 136 } 137 138 // WithUsername adds the username to the add email params 139 func (o *AddEmailParams) WithUsername(username string) *AddEmailParams { 140 o.SetUsername(username) 141 return o 142 } 143 144 // SetUsername adds the username to the add email params 145 func (o *AddEmailParams) SetUsername(username string) { 146 o.Username = username 147 } 148 149 // WriteToRequest writes these params to a swagger request 150 func (o *AddEmailParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 151 152 if err := r.SetTimeout(o.timeout); err != nil { 153 return err 154 } 155 var res []error 156 if err := r.SetBodyParam(o.Email); err != nil { 157 return err 158 } 159 160 // path param username 161 if err := r.SetPathParam("username", o.Username); err != nil { 162 return err 163 } 164 165 if len(res) > 0 { 166 return errors.CompositeValidationError(res...) 167 } 168 return nil 169 }