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