github.com/circl-dev/go-swagger@v0.31.0/examples/task-tracker/client/tasks/get_task_comments_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 // NewGetTaskCommentsParams creates a new GetTaskCommentsParams 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 NewGetTaskCommentsParams() *GetTaskCommentsParams { 27 return &GetTaskCommentsParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewGetTaskCommentsParamsWithTimeout creates a new GetTaskCommentsParams object 33 // with the ability to set a timeout on a request. 34 func NewGetTaskCommentsParamsWithTimeout(timeout time.Duration) *GetTaskCommentsParams { 35 return &GetTaskCommentsParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewGetTaskCommentsParamsWithContext creates a new GetTaskCommentsParams object 41 // with the ability to set a context for a request. 42 func NewGetTaskCommentsParamsWithContext(ctx context.Context) *GetTaskCommentsParams { 43 return &GetTaskCommentsParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewGetTaskCommentsParamsWithHTTPClient creates a new GetTaskCommentsParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewGetTaskCommentsParamsWithHTTPClient(client *http.Client) *GetTaskCommentsParams { 51 return &GetTaskCommentsParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* GetTaskCommentsParams contains all the parameters to send to the API endpoint 57 for the get task comments operation. 58 59 Typically these are written to a http.Request. 60 */ 61 type GetTaskCommentsParams struct { 62 63 /* ID. 64 65 The id of the item 66 67 Format: int64 68 */ 69 ID int64 70 71 /* PageSize. 72 73 Amount of items to return in a single page 74 75 Format: int32 76 Default: 20 77 */ 78 PageSize *int32 79 80 /* Since. 81 82 The created time of the oldest seen comment 83 84 Format: date-time 85 */ 86 Since *strfmt.DateTime 87 88 timeout time.Duration 89 Context context.Context 90 HTTPClient *http.Client 91 } 92 93 // WithDefaults hydrates default values in the get task comments params (not the query body). 94 // 95 // All values with no default are reset to their zero value. 96 func (o *GetTaskCommentsParams) WithDefaults() *GetTaskCommentsParams { 97 o.SetDefaults() 98 return o 99 } 100 101 // SetDefaults hydrates default values in the get task comments params (not the query body). 102 // 103 // All values with no default are reset to their zero value. 104 func (o *GetTaskCommentsParams) SetDefaults() { 105 var ( 106 pageSizeDefault = int32(20) 107 ) 108 109 val := GetTaskCommentsParams{ 110 PageSize: &pageSizeDefault, 111 } 112 113 val.timeout = o.timeout 114 val.Context = o.Context 115 val.HTTPClient = o.HTTPClient 116 *o = val 117 } 118 119 // WithTimeout adds the timeout to the get task comments params 120 func (o *GetTaskCommentsParams) WithTimeout(timeout time.Duration) *GetTaskCommentsParams { 121 o.SetTimeout(timeout) 122 return o 123 } 124 125 // SetTimeout adds the timeout to the get task comments params 126 func (o *GetTaskCommentsParams) SetTimeout(timeout time.Duration) { 127 o.timeout = timeout 128 } 129 130 // WithContext adds the context to the get task comments params 131 func (o *GetTaskCommentsParams) WithContext(ctx context.Context) *GetTaskCommentsParams { 132 o.SetContext(ctx) 133 return o 134 } 135 136 // SetContext adds the context to the get task comments params 137 func (o *GetTaskCommentsParams) SetContext(ctx context.Context) { 138 o.Context = ctx 139 } 140 141 // WithHTTPClient adds the HTTPClient to the get task comments params 142 func (o *GetTaskCommentsParams) WithHTTPClient(client *http.Client) *GetTaskCommentsParams { 143 o.SetHTTPClient(client) 144 return o 145 } 146 147 // SetHTTPClient adds the HTTPClient to the get task comments params 148 func (o *GetTaskCommentsParams) SetHTTPClient(client *http.Client) { 149 o.HTTPClient = client 150 } 151 152 // WithID adds the id to the get task comments params 153 func (o *GetTaskCommentsParams) WithID(id int64) *GetTaskCommentsParams { 154 o.SetID(id) 155 return o 156 } 157 158 // SetID adds the id to the get task comments params 159 func (o *GetTaskCommentsParams) SetID(id int64) { 160 o.ID = id 161 } 162 163 // WithPageSize adds the pageSize to the get task comments params 164 func (o *GetTaskCommentsParams) WithPageSize(pageSize *int32) *GetTaskCommentsParams { 165 o.SetPageSize(pageSize) 166 return o 167 } 168 169 // SetPageSize adds the pageSize to the get task comments params 170 func (o *GetTaskCommentsParams) SetPageSize(pageSize *int32) { 171 o.PageSize = pageSize 172 } 173 174 // WithSince adds the since to the get task comments params 175 func (o *GetTaskCommentsParams) WithSince(since *strfmt.DateTime) *GetTaskCommentsParams { 176 o.SetSince(since) 177 return o 178 } 179 180 // SetSince adds the since to the get task comments params 181 func (o *GetTaskCommentsParams) SetSince(since *strfmt.DateTime) { 182 o.Since = since 183 } 184 185 // WriteToRequest writes these params to a swagger request 186 func (o *GetTaskCommentsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 187 188 if err := r.SetTimeout(o.timeout); err != nil { 189 return err 190 } 191 var res []error 192 193 // path param id 194 if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 195 return err 196 } 197 198 if o.PageSize != nil { 199 200 // query param pageSize 201 var qrPageSize int32 202 203 if o.PageSize != nil { 204 qrPageSize = *o.PageSize 205 } 206 qPageSize := swag.FormatInt32(qrPageSize) 207 if qPageSize != "" { 208 209 if err := r.SetQueryParam("pageSize", qPageSize); err != nil { 210 return err 211 } 212 } 213 } 214 215 if o.Since != nil { 216 217 // query param since 218 var qrSince strfmt.DateTime 219 220 if o.Since != nil { 221 qrSince = *o.Since 222 } 223 qSince := qrSince.String() 224 if qSince != "" { 225 226 if err := r.SetQueryParam("since", qSince); err != nil { 227 return err 228 } 229 } 230 } 231 232 if len(res) > 0 { 233 return errors.CompositeValidationError(res...) 234 } 235 return nil 236 }