github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/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/runtime" 15 cr "github.com/go-openapi/runtime/client" 16 "github.com/go-openapi/strfmt" 17 "github.com/go-openapi/swag" 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 /* 57 DestroyOneParams contains all the parameters to send to the API endpoint 58 59 for the destroy one operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type DestroyOneParams struct { 64 65 // ID. 66 // 67 // Format: int64 68 ID int64 69 70 timeout time.Duration 71 Context context.Context 72 HTTPClient *http.Client 73 } 74 75 // WithDefaults hydrates default values in the destroy one params (not the query body). 76 // 77 // All values with no default are reset to their zero value. 78 func (o *DestroyOneParams) WithDefaults() *DestroyOneParams { 79 o.SetDefaults() 80 return o 81 } 82 83 // SetDefaults hydrates default values in the destroy one params (not the query body). 84 // 85 // All values with no default are reset to their zero value. 86 func (o *DestroyOneParams) SetDefaults() { 87 // no default values defined for this parameter 88 } 89 90 // WithTimeout adds the timeout to the destroy one params 91 func (o *DestroyOneParams) WithTimeout(timeout time.Duration) *DestroyOneParams { 92 o.SetTimeout(timeout) 93 return o 94 } 95 96 // SetTimeout adds the timeout to the destroy one params 97 func (o *DestroyOneParams) SetTimeout(timeout time.Duration) { 98 o.timeout = timeout 99 } 100 101 // WithContext adds the context to the destroy one params 102 func (o *DestroyOneParams) WithContext(ctx context.Context) *DestroyOneParams { 103 o.SetContext(ctx) 104 return o 105 } 106 107 // SetContext adds the context to the destroy one params 108 func (o *DestroyOneParams) SetContext(ctx context.Context) { 109 o.Context = ctx 110 } 111 112 // WithHTTPClient adds the HTTPClient to the destroy one params 113 func (o *DestroyOneParams) WithHTTPClient(client *http.Client) *DestroyOneParams { 114 o.SetHTTPClient(client) 115 return o 116 } 117 118 // SetHTTPClient adds the HTTPClient to the destroy one params 119 func (o *DestroyOneParams) SetHTTPClient(client *http.Client) { 120 o.HTTPClient = client 121 } 122 123 // WithID adds the id to the destroy one params 124 func (o *DestroyOneParams) WithID(id int64) *DestroyOneParams { 125 o.SetID(id) 126 return o 127 } 128 129 // SetID adds the id to the destroy one params 130 func (o *DestroyOneParams) SetID(id int64) { 131 o.ID = id 132 } 133 134 // WriteToRequest writes these params to a swagger request 135 func (o *DestroyOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 136 137 if err := r.SetTimeout(o.timeout); err != nil { 138 return err 139 } 140 var res []error 141 142 // path param id 143 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 144 return err 145 } 146 147 if len(res) > 0 { 148 return errors.CompositeValidationError(res...) 149 } 150 return nil 151 }