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