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