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