github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/task-tracker/client/tasks/add_comment_to_task_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package tasks 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 // NewAddCommentToTaskParams creates a new AddCommentToTaskParams 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 NewAddCommentToTaskParams() *AddCommentToTaskParams { 27 return &AddCommentToTaskParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewAddCommentToTaskParamsWithTimeout creates a new AddCommentToTaskParams object 33 // with the ability to set a timeout on a request. 34 func NewAddCommentToTaskParamsWithTimeout(timeout time.Duration) *AddCommentToTaskParams { 35 return &AddCommentToTaskParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewAddCommentToTaskParamsWithContext creates a new AddCommentToTaskParams object 41 // with the ability to set a context for a request. 42 func NewAddCommentToTaskParamsWithContext(ctx context.Context) *AddCommentToTaskParams { 43 return &AddCommentToTaskParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewAddCommentToTaskParamsWithHTTPClient creates a new AddCommentToTaskParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewAddCommentToTaskParamsWithHTTPClient(client *http.Client) *AddCommentToTaskParams { 51 return &AddCommentToTaskParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 AddCommentToTaskParams contains all the parameters to send to the API endpoint 58 59 for the add comment to task operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type AddCommentToTaskParams struct { 64 65 /* Body. 66 67 The comment to add 68 */ 69 Body AddCommentToTaskBody 70 71 /* ID. 72 73 The id of the item 74 75 Format: int64 76 */ 77 ID int64 78 79 timeout time.Duration 80 Context context.Context 81 HTTPClient *http.Client 82 } 83 84 // WithDefaults hydrates default values in the add comment to task params (not the query body). 85 // 86 // All values with no default are reset to their zero value. 87 func (o *AddCommentToTaskParams) WithDefaults() *AddCommentToTaskParams { 88 o.SetDefaults() 89 return o 90 } 91 92 // SetDefaults hydrates default values in the add comment to task params (not the query body). 93 // 94 // All values with no default are reset to their zero value. 95 func (o *AddCommentToTaskParams) SetDefaults() { 96 // no default values defined for this parameter 97 } 98 99 // WithTimeout adds the timeout to the add comment to task params 100 func (o *AddCommentToTaskParams) WithTimeout(timeout time.Duration) *AddCommentToTaskParams { 101 o.SetTimeout(timeout) 102 return o 103 } 104 105 // SetTimeout adds the timeout to the add comment to task params 106 func (o *AddCommentToTaskParams) SetTimeout(timeout time.Duration) { 107 o.timeout = timeout 108 } 109 110 // WithContext adds the context to the add comment to task params 111 func (o *AddCommentToTaskParams) WithContext(ctx context.Context) *AddCommentToTaskParams { 112 o.SetContext(ctx) 113 return o 114 } 115 116 // SetContext adds the context to the add comment to task params 117 func (o *AddCommentToTaskParams) SetContext(ctx context.Context) { 118 o.Context = ctx 119 } 120 121 // WithHTTPClient adds the HTTPClient to the add comment to task params 122 func (o *AddCommentToTaskParams) WithHTTPClient(client *http.Client) *AddCommentToTaskParams { 123 o.SetHTTPClient(client) 124 return o 125 } 126 127 // SetHTTPClient adds the HTTPClient to the add comment to task params 128 func (o *AddCommentToTaskParams) SetHTTPClient(client *http.Client) { 129 o.HTTPClient = client 130 } 131 132 // WithBody adds the body to the add comment to task params 133 func (o *AddCommentToTaskParams) WithBody(body AddCommentToTaskBody) *AddCommentToTaskParams { 134 o.SetBody(body) 135 return o 136 } 137 138 // SetBody adds the body to the add comment to task params 139 func (o *AddCommentToTaskParams) SetBody(body AddCommentToTaskBody) { 140 o.Body = body 141 } 142 143 // WithID adds the id to the add comment to task params 144 func (o *AddCommentToTaskParams) WithID(id int64) *AddCommentToTaskParams { 145 o.SetID(id) 146 return o 147 } 148 149 // SetID adds the id to the add comment to task params 150 func (o *AddCommentToTaskParams) SetID(id int64) { 151 o.ID = id 152 } 153 154 // WriteToRequest writes these params to a swagger request 155 func (o *AddCommentToTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 156 157 if err := r.SetTimeout(o.timeout); err != nil { 158 return err 159 } 160 var res []error 161 if err := r.SetBodyParam(o.Body); err != nil { 162 return err 163 } 164 165 // path param id 166 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 167 return err 168 } 169 170 if len(res) > 0 { 171 return errors.CompositeValidationError(res...) 172 } 173 return nil 174 }