github.com/circl-dev/go-swagger@v0.31.0/examples/task-tracker/client/tasks/update_task_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package tasks 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/strfmt" 15 "github.com/go-openapi/swag" 16 "github.com/circl-dev/runtime" 17 cr "github.com/circl-dev/runtime/client" 18 19 "github.com/circl-dev/go-swagger/examples/task-tracker/models" 20 ) 21 22 // NewUpdateTaskParams creates a new UpdateTaskParams object, 23 // with the default timeout for this client. 24 // 25 // Default values are not hydrated, since defaults are normally applied by the API server side. 26 // 27 // To enforce default values in parameter, use SetDefaults or WithDefaults. 28 func NewUpdateTaskParams() *UpdateTaskParams { 29 return &UpdateTaskParams{ 30 timeout: cr.DefaultTimeout, 31 } 32 } 33 34 // NewUpdateTaskParamsWithTimeout creates a new UpdateTaskParams object 35 // with the ability to set a timeout on a request. 36 func NewUpdateTaskParamsWithTimeout(timeout time.Duration) *UpdateTaskParams { 37 return &UpdateTaskParams{ 38 timeout: timeout, 39 } 40 } 41 42 // NewUpdateTaskParamsWithContext creates a new UpdateTaskParams object 43 // with the ability to set a context for a request. 44 func NewUpdateTaskParamsWithContext(ctx context.Context) *UpdateTaskParams { 45 return &UpdateTaskParams{ 46 Context: ctx, 47 } 48 } 49 50 // NewUpdateTaskParamsWithHTTPClient creates a new UpdateTaskParams object 51 // with the ability to set a custom HTTPClient for a request. 52 func NewUpdateTaskParamsWithHTTPClient(client *http.Client) *UpdateTaskParams { 53 return &UpdateTaskParams{ 54 HTTPClient: client, 55 } 56 } 57 58 /* UpdateTaskParams contains all the parameters to send to the API endpoint 59 for the update task operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type UpdateTaskParams struct { 64 65 /* Body. 66 67 The task to update 68 */ 69 Body *models.Task 70 71 /* ID. 72 73 The id of the item 74 75 Format: int64 76 */ 77 ID int64 78 79 timeout time.Duration 80 Context context.Context 81 HTTPClient *http.Client 82 } 83 84 // WithDefaults hydrates default values in the update task params (not the query body). 85 // 86 // All values with no default are reset to their zero value. 87 func (o *UpdateTaskParams) WithDefaults() *UpdateTaskParams { 88 o.SetDefaults() 89 return o 90 } 91 92 // SetDefaults hydrates default values in the update task params (not the query body). 93 // 94 // All values with no default are reset to their zero value. 95 func (o *UpdateTaskParams) SetDefaults() { 96 // no default values defined for this parameter 97 } 98 99 // WithTimeout adds the timeout to the update task params 100 func (o *UpdateTaskParams) WithTimeout(timeout time.Duration) *UpdateTaskParams { 101 o.SetTimeout(timeout) 102 return o 103 } 104 105 // SetTimeout adds the timeout to the update task params 106 func (o *UpdateTaskParams) SetTimeout(timeout time.Duration) { 107 o.timeout = timeout 108 } 109 110 // WithContext adds the context to the update task params 111 func (o *UpdateTaskParams) WithContext(ctx context.Context) *UpdateTaskParams { 112 o.SetContext(ctx) 113 return o 114 } 115 116 // SetContext adds the context to the update task params 117 func (o *UpdateTaskParams) SetContext(ctx context.Context) { 118 o.Context = ctx 119 } 120 121 // WithHTTPClient adds the HTTPClient to the update task params 122 func (o *UpdateTaskParams) WithHTTPClient(client *http.Client) *UpdateTaskParams { 123 o.SetHTTPClient(client) 124 return o 125 } 126 127 // SetHTTPClient adds the HTTPClient to the update task params 128 func (o *UpdateTaskParams) SetHTTPClient(client *http.Client) { 129 o.HTTPClient = client 130 } 131 132 // WithBody adds the body to the update task params 133 func (o *UpdateTaskParams) WithBody(body *models.Task) *UpdateTaskParams { 134 o.SetBody(body) 135 return o 136 } 137 138 // SetBody adds the body to the update task params 139 func (o *UpdateTaskParams) SetBody(body *models.Task) { 140 o.Body = body 141 } 142 143 // WithID adds the id to the update task params 144 func (o *UpdateTaskParams) WithID(id int64) *UpdateTaskParams { 145 o.SetID(id) 146 return o 147 } 148 149 // SetID adds the id to the update task params 150 func (o *UpdateTaskParams) SetID(id int64) { 151 o.ID = id 152 } 153 154 // WriteToRequest writes these params to a swagger request 155 func (o *UpdateTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 156 157 if err := r.SetTimeout(o.timeout); err != nil { 158 return err 159 } 160 var res []error 161 if o.Body != nil { 162 if err := r.SetBodyParam(o.Body); err != nil { 163 return err 164 } 165 } 166 167 // path param id 168 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 169 return err 170 } 171 172 if len(res) > 0 { 173 return errors.CompositeValidationError(res...) 174 } 175 return nil 176 }