github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/user/list_users_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package user 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 // NewListUsersParams creates a new ListUsersParams 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 NewListUsersParams() *ListUsersParams { 27 return &ListUsersParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewListUsersParamsWithTimeout creates a new ListUsersParams object 33 // with the ability to set a timeout on a request. 34 func NewListUsersParamsWithTimeout(timeout time.Duration) *ListUsersParams { 35 return &ListUsersParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewListUsersParamsWithContext creates a new ListUsersParams object 41 // with the ability to set a context for a request. 42 func NewListUsersParamsWithContext(ctx context.Context) *ListUsersParams { 43 return &ListUsersParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewListUsersParamsWithHTTPClient creates a new ListUsersParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewListUsersParamsWithHTTPClient(client *http.Client) *ListUsersParams { 51 return &ListUsersParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 ListUsersParams contains all the parameters to send to the API endpoint 58 59 for the list users operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type ListUsersParams struct { 64 65 /* XRequestID. 66 67 An unique ID for the request 68 */ 69 XRequestID *string 70 71 /* Page. 72 73 The page number 74 75 Format: int64 76 Default: 1 77 */ 78 Page *int64 79 80 /* PageSize. 81 82 The size of per page 83 84 Format: int64 85 Default: 10 86 */ 87 PageSize *int64 88 89 /* Q. 90 91 Query string to query resources. Supported query patterns are "exact match(k=v)", "fuzzy match(k=~v)", "range(k=[min~max])", "list with union releationship(k={v1 v2 v3})" and "list with intersetion relationship(k=(v1 v2 v3))". The value of range and list can be string(enclosed by " or '), integer or time(in format "2020-04-09 02:36:00"). All of these query patterns should be put in the query string "q=xxx" and splitted by ",". e.g. q=k1=v1,k2=~v2,k3=[min~max] 92 */ 93 Q *string 94 95 /* Sort. 96 97 Sort the resource list in ascending or descending order. e.g. sort by field1 in ascending order and field2 in descending order with "sort=field1,-field2" 98 */ 99 Sort *string 100 101 timeout time.Duration 102 Context context.Context 103 HTTPClient *http.Client 104 } 105 106 // WithDefaults hydrates default values in the list users params (not the query body). 107 // 108 // All values with no default are reset to their zero value. 109 func (o *ListUsersParams) WithDefaults() *ListUsersParams { 110 o.SetDefaults() 111 return o 112 } 113 114 // SetDefaults hydrates default values in the list users params (not the query body). 115 // 116 // All values with no default are reset to their zero value. 117 func (o *ListUsersParams) SetDefaults() { 118 var ( 119 pageDefault = int64(1) 120 121 pageSizeDefault = int64(10) 122 ) 123 124 val := ListUsersParams{ 125 Page: &pageDefault, 126 PageSize: &pageSizeDefault, 127 } 128 129 val.timeout = o.timeout 130 val.Context = o.Context 131 val.HTTPClient = o.HTTPClient 132 *o = val 133 } 134 135 // WithTimeout adds the timeout to the list users params 136 func (o *ListUsersParams) WithTimeout(timeout time.Duration) *ListUsersParams { 137 o.SetTimeout(timeout) 138 return o 139 } 140 141 // SetTimeout adds the timeout to the list users params 142 func (o *ListUsersParams) SetTimeout(timeout time.Duration) { 143 o.timeout = timeout 144 } 145 146 // WithContext adds the context to the list users params 147 func (o *ListUsersParams) WithContext(ctx context.Context) *ListUsersParams { 148 o.SetContext(ctx) 149 return o 150 } 151 152 // SetContext adds the context to the list users params 153 func (o *ListUsersParams) SetContext(ctx context.Context) { 154 o.Context = ctx 155 } 156 157 // WithHTTPClient adds the HTTPClient to the list users params 158 func (o *ListUsersParams) WithHTTPClient(client *http.Client) *ListUsersParams { 159 o.SetHTTPClient(client) 160 return o 161 } 162 163 // SetHTTPClient adds the HTTPClient to the list users params 164 func (o *ListUsersParams) SetHTTPClient(client *http.Client) { 165 o.HTTPClient = client 166 } 167 168 // WithXRequestID adds the xRequestID to the list users params 169 func (o *ListUsersParams) WithXRequestID(xRequestID *string) *ListUsersParams { 170 o.SetXRequestID(xRequestID) 171 return o 172 } 173 174 // SetXRequestID adds the xRequestId to the list users params 175 func (o *ListUsersParams) SetXRequestID(xRequestID *string) { 176 o.XRequestID = xRequestID 177 } 178 179 // WithPage adds the page to the list users params 180 func (o *ListUsersParams) WithPage(page *int64) *ListUsersParams { 181 o.SetPage(page) 182 return o 183 } 184 185 // SetPage adds the page to the list users params 186 func (o *ListUsersParams) SetPage(page *int64) { 187 o.Page = page 188 } 189 190 // WithPageSize adds the pageSize to the list users params 191 func (o *ListUsersParams) WithPageSize(pageSize *int64) *ListUsersParams { 192 o.SetPageSize(pageSize) 193 return o 194 } 195 196 // SetPageSize adds the pageSize to the list users params 197 func (o *ListUsersParams) SetPageSize(pageSize *int64) { 198 o.PageSize = pageSize 199 } 200 201 // WithQ adds the q to the list users params 202 func (o *ListUsersParams) WithQ(q *string) *ListUsersParams { 203 o.SetQ(q) 204 return o 205 } 206 207 // SetQ adds the q to the list users params 208 func (o *ListUsersParams) SetQ(q *string) { 209 o.Q = q 210 } 211 212 // WithSort adds the sort to the list users params 213 func (o *ListUsersParams) WithSort(sort *string) *ListUsersParams { 214 o.SetSort(sort) 215 return o 216 } 217 218 // SetSort adds the sort to the list users params 219 func (o *ListUsersParams) SetSort(sort *string) { 220 o.Sort = sort 221 } 222 223 // WriteToRequest writes these params to a swagger request 224 func (o *ListUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 225 226 if err := r.SetTimeout(o.timeout); err != nil { 227 return err 228 } 229 var res []error 230 231 if o.XRequestID != nil { 232 233 // header param X-Request-Id 234 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 235 return err 236 } 237 } 238 239 if o.Page != nil { 240 241 // query param page 242 var qrPage int64 243 244 if o.Page != nil { 245 qrPage = *o.Page 246 } 247 qPage := swag.FormatInt64(qrPage) 248 if qPage != "" { 249 250 if err := r.SetQueryParam("page", qPage); err != nil { 251 return err 252 } 253 } 254 } 255 256 if o.PageSize != nil { 257 258 // query param page_size 259 var qrPageSize int64 260 261 if o.PageSize != nil { 262 qrPageSize = *o.PageSize 263 } 264 qPageSize := swag.FormatInt64(qrPageSize) 265 if qPageSize != "" { 266 267 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 268 return err 269 } 270 } 271 } 272 273 if o.Q != nil { 274 275 // query param q 276 var qrQ string 277 278 if o.Q != nil { 279 qrQ = *o.Q 280 } 281 qQ := qrQ 282 if qQ != "" { 283 284 if err := r.SetQueryParam("q", qQ); err != nil { 285 return err 286 } 287 } 288 } 289 290 if o.Sort != nil { 291 292 // query param sort 293 var qrSort string 294 295 if o.Sort != nil { 296 qrSort = *o.Sort 297 } 298 qSort := qrSort 299 if qSort != "" { 300 301 if err := r.SetQueryParam("sort", qSort); err != nil { 302 return err 303 } 304 } 305 } 306 307 if len(res) > 0 { 308 return errors.CompositeValidationError(res...) 309 } 310 return nil 311 }