github.com/circl-dev/go-swagger@v0.31.0/examples/todo-list-strict/client/todos/update_one_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package todos 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/circl-dev/runtime" 16 cr "github.com/circl-dev/runtime/client" 17 18 "github.com/circl-dev/go-swagger/examples/todo-list/models" 19 ) 20 21 // NewUpdateOneParams creates a new UpdateOneParams object 22 // with the default values initialized. 23 func NewUpdateOneParams() *UpdateOneParams { 24 var () 25 return &UpdateOneParams{ 26 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewUpdateOneParamsWithTimeout creates a new UpdateOneParams object 32 // with the default values initialized, and the ability to set a timeout on a request 33 func NewUpdateOneParamsWithTimeout(timeout time.Duration) *UpdateOneParams { 34 var () 35 return &UpdateOneParams{ 36 37 timeout: timeout, 38 } 39 } 40 41 // NewUpdateOneParamsWithContext creates a new UpdateOneParams object 42 // with the default values initialized, and the ability to set a context for a request 43 func NewUpdateOneParamsWithContext(ctx context.Context) *UpdateOneParams { 44 var () 45 return &UpdateOneParams{ 46 47 Context: ctx, 48 } 49 } 50 51 // NewUpdateOneParamsWithHTTPClient creates a new UpdateOneParams object 52 // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 func NewUpdateOneParamsWithHTTPClient(client *http.Client) *UpdateOneParams { 54 var () 55 return &UpdateOneParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /*UpdateOneParams contains all the parameters to send to the API endpoint 61 for the update one operation typically these are written to a http.Request 62 */ 63 type UpdateOneParams struct { 64 65 /*Body*/ 66 Body *models.Item 67 /*ID*/ 68 ID string 69 70 timeout time.Duration 71 Context context.Context 72 HTTPClient *http.Client 73 } 74 75 // WithTimeout adds the timeout to the update one params 76 func (o *UpdateOneParams) WithTimeout(timeout time.Duration) *UpdateOneParams { 77 o.SetTimeout(timeout) 78 return o 79 } 80 81 // SetTimeout adds the timeout to the update one params 82 func (o *UpdateOneParams) SetTimeout(timeout time.Duration) { 83 o.timeout = timeout 84 } 85 86 // WithContext adds the context to the update one params 87 func (o *UpdateOneParams) WithContext(ctx context.Context) *UpdateOneParams { 88 o.SetContext(ctx) 89 return o 90 } 91 92 // SetContext adds the context to the update one params 93 func (o *UpdateOneParams) SetContext(ctx context.Context) { 94 o.Context = ctx 95 } 96 97 // WithHTTPClient adds the HTTPClient to the update one params 98 func (o *UpdateOneParams) WithHTTPClient(client *http.Client) *UpdateOneParams { 99 o.SetHTTPClient(client) 100 return o 101 } 102 103 // SetHTTPClient adds the HTTPClient to the update one params 104 func (o *UpdateOneParams) SetHTTPClient(client *http.Client) { 105 o.HTTPClient = client 106 } 107 108 // WithBody adds the body to the update one params 109 func (o *UpdateOneParams) WithBody(body *models.Item) *UpdateOneParams { 110 o.SetBody(body) 111 return o 112 } 113 114 // SetBody adds the body to the update one params 115 func (o *UpdateOneParams) SetBody(body *models.Item) { 116 o.Body = body 117 } 118 119 // WithID adds the id to the update one params 120 func (o *UpdateOneParams) WithID(id string) *UpdateOneParams { 121 o.SetID(id) 122 return o 123 } 124 125 // SetID adds the id to the update one params 126 func (o *UpdateOneParams) SetID(id string) { 127 o.ID = id 128 } 129 130 // WriteToRequest writes these params to a swagger request 131 func (o *UpdateOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 132 133 if err := r.SetTimeout(o.timeout); err != nil { 134 return err 135 } 136 var res []error 137 138 if o.Body != nil { 139 if err := r.SetBodyParam(o.Body); err != nil { 140 return err 141 } 142 } 143 144 // path param id 145 if err := r.SetPathParam("id", o.ID); err != nil { 146 return err 147 } 148 149 if len(res) > 0 { 150 return errors.CompositeValidationError(res...) 151 } 152 return nil 153 }