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