github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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/runtime" 15 cr "github.com/go-openapi/runtime/client" 16 "github.com/go-openapi/strfmt" 17 "github.com/go-openapi/swag" 18 19 "github.com/thetreep/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 /* 59 UpdateTaskParams contains all the parameters to send to the API endpoint 60 61 for the update task operation. 62 63 Typically these are written to a http.Request. 64 */ 65 type UpdateTaskParams struct { 66 67 /* Body. 68 69 The task to update 70 */ 71 Body *models.Task 72 73 /* ID. 74 75 The id of the item 76 77 Format: int64 78 */ 79 ID int64 80 81 timeout time.Duration 82 Context context.Context 83 HTTPClient *http.Client 84 } 85 86 // WithDefaults hydrates default values in the update task params (not the query body). 87 // 88 // All values with no default are reset to their zero value. 89 func (o *UpdateTaskParams) WithDefaults() *UpdateTaskParams { 90 o.SetDefaults() 91 return o 92 } 93 94 // SetDefaults hydrates default values in the update task params (not the query body). 95 // 96 // All values with no default are reset to their zero value. 97 func (o *UpdateTaskParams) SetDefaults() { 98 // no default values defined for this parameter 99 } 100 101 // WithTimeout adds the timeout to the update task params 102 func (o *UpdateTaskParams) WithTimeout(timeout time.Duration) *UpdateTaskParams { 103 o.SetTimeout(timeout) 104 return o 105 } 106 107 // SetTimeout adds the timeout to the update task params 108 func (o *UpdateTaskParams) SetTimeout(timeout time.Duration) { 109 o.timeout = timeout 110 } 111 112 // WithContext adds the context to the update task params 113 func (o *UpdateTaskParams) WithContext(ctx context.Context) *UpdateTaskParams { 114 o.SetContext(ctx) 115 return o 116 } 117 118 // SetContext adds the context to the update task params 119 func (o *UpdateTaskParams) SetContext(ctx context.Context) { 120 o.Context = ctx 121 } 122 123 // WithHTTPClient adds the HTTPClient to the update task params 124 func (o *UpdateTaskParams) WithHTTPClient(client *http.Client) *UpdateTaskParams { 125 o.SetHTTPClient(client) 126 return o 127 } 128 129 // SetHTTPClient adds the HTTPClient to the update task params 130 func (o *UpdateTaskParams) SetHTTPClient(client *http.Client) { 131 o.HTTPClient = client 132 } 133 134 // WithBody adds the body to the update task params 135 func (o *UpdateTaskParams) WithBody(body *models.Task) *UpdateTaskParams { 136 o.SetBody(body) 137 return o 138 } 139 140 // SetBody adds the body to the update task params 141 func (o *UpdateTaskParams) SetBody(body *models.Task) { 142 o.Body = body 143 } 144 145 // WithID adds the id to the update task params 146 func (o *UpdateTaskParams) WithID(id int64) *UpdateTaskParams { 147 o.SetID(id) 148 return o 149 } 150 151 // SetID adds the id to the update task params 152 func (o *UpdateTaskParams) SetID(id int64) { 153 o.ID = id 154 } 155 156 // WriteToRequest writes these params to a swagger request 157 func (o *UpdateTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 158 159 if err := r.SetTimeout(o.timeout); err != nil { 160 return err 161 } 162 var res []error 163 if o.Body != nil { 164 if err := r.SetBodyParam(o.Body); err != nil { 165 return err 166 } 167 } 168 169 // path param id 170 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 171 return err 172 } 173 174 if len(res) > 0 { 175 return errors.CompositeValidationError(res...) 176 } 177 return nil 178 }