github.com/rzurga/go-swagger@v0.28.1-0.20211109195225-5d1f453ffa3a/examples/todo-list/client/todos/destroy_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 "github.com/go-openapi/strfmt" 17 ) 18 19 // NewDestroyOneParams creates a new DestroyOneParams 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 NewDestroyOneParams() *DestroyOneParams { 26 return &DestroyOneParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewDestroyOneParamsWithTimeout creates a new DestroyOneParams object 32 // with the ability to set a timeout on a request. 33 func NewDestroyOneParamsWithTimeout(timeout time.Duration) *DestroyOneParams { 34 return &DestroyOneParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewDestroyOneParamsWithContext creates a new DestroyOneParams object 40 // with the ability to set a context for a request. 41 func NewDestroyOneParamsWithContext(ctx context.Context) *DestroyOneParams { 42 return &DestroyOneParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewDestroyOneParamsWithHTTPClient creates a new DestroyOneParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewDestroyOneParamsWithHTTPClient(client *http.Client) *DestroyOneParams { 50 return &DestroyOneParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* DestroyOneParams contains all the parameters to send to the API endpoint 56 for the destroy one operation. 57 58 Typically these are written to a http.Request. 59 */ 60 type DestroyOneParams struct { 61 62 // ID. 63 ID string 64 65 timeout time.Duration 66 Context context.Context 67 HTTPClient *http.Client 68 } 69 70 // WithDefaults hydrates default values in the destroy one params (not the query body). 71 // 72 // All values with no default are reset to their zero value. 73 func (o *DestroyOneParams) WithDefaults() *DestroyOneParams { 74 o.SetDefaults() 75 return o 76 } 77 78 // SetDefaults hydrates default values in the destroy one params (not the query body). 79 // 80 // All values with no default are reset to their zero value. 81 func (o *DestroyOneParams) SetDefaults() { 82 // no default values defined for this parameter 83 } 84 85 // WithTimeout adds the timeout to the destroy one params 86 func (o *DestroyOneParams) WithTimeout(timeout time.Duration) *DestroyOneParams { 87 o.SetTimeout(timeout) 88 return o 89 } 90 91 // SetTimeout adds the timeout to the destroy one params 92 func (o *DestroyOneParams) SetTimeout(timeout time.Duration) { 93 o.timeout = timeout 94 } 95 96 // WithContext adds the context to the destroy one params 97 func (o *DestroyOneParams) WithContext(ctx context.Context) *DestroyOneParams { 98 o.SetContext(ctx) 99 return o 100 } 101 102 // SetContext adds the context to the destroy one params 103 func (o *DestroyOneParams) SetContext(ctx context.Context) { 104 o.Context = ctx 105 } 106 107 // WithHTTPClient adds the HTTPClient to the destroy one params 108 func (o *DestroyOneParams) WithHTTPClient(client *http.Client) *DestroyOneParams { 109 o.SetHTTPClient(client) 110 return o 111 } 112 113 // SetHTTPClient adds the HTTPClient to the destroy one params 114 func (o *DestroyOneParams) SetHTTPClient(client *http.Client) { 115 o.HTTPClient = client 116 } 117 118 // WithID adds the id to the destroy one params 119 func (o *DestroyOneParams) WithID(id string) *DestroyOneParams { 120 o.SetID(id) 121 return o 122 } 123 124 // SetID adds the id to the destroy one params 125 func (o *DestroyOneParams) SetID(id string) { 126 o.ID = id 127 } 128 129 // WriteToRequest writes these params to a swagger request 130 func (o *DestroyOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 131 132 if err := r.SetTimeout(o.timeout); err != nil { 133 return err 134 } 135 var res []error 136 137 // path param id 138 if err := r.SetPathParam("id", o.ID); err != nil { 139 return err 140 } 141 142 if len(res) > 0 { 143 return errors.CompositeValidationError(res...) 144 } 145 return nil 146 }