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