github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/schedule/list_schedules_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package schedule 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 // NewListSchedulesParams creates a new ListSchedulesParams 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 NewListSchedulesParams() *ListSchedulesParams { 27 return &ListSchedulesParams{ 28 timeout: cr.DefaultTimeout, 29 } 30 } 31 32 // NewListSchedulesParamsWithTimeout creates a new ListSchedulesParams object 33 // with the ability to set a timeout on a request. 34 func NewListSchedulesParamsWithTimeout(timeout time.Duration) *ListSchedulesParams { 35 return &ListSchedulesParams{ 36 timeout: timeout, 37 } 38 } 39 40 // NewListSchedulesParamsWithContext creates a new ListSchedulesParams object 41 // with the ability to set a context for a request. 42 func NewListSchedulesParamsWithContext(ctx context.Context) *ListSchedulesParams { 43 return &ListSchedulesParams{ 44 Context: ctx, 45 } 46 } 47 48 // NewListSchedulesParamsWithHTTPClient creates a new ListSchedulesParams object 49 // with the ability to set a custom HTTPClient for a request. 50 func NewListSchedulesParamsWithHTTPClient(client *http.Client) *ListSchedulesParams { 51 return &ListSchedulesParams{ 52 HTTPClient: client, 53 } 54 } 55 56 /* 57 ListSchedulesParams contains all the parameters to send to the API endpoint 58 59 for the list schedules operation. 60 61 Typically these are written to a http.Request. 62 */ 63 type ListSchedulesParams 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 timeout time.Duration 90 Context context.Context 91 HTTPClient *http.Client 92 } 93 94 // WithDefaults hydrates default values in the list schedules params (not the query body). 95 // 96 // All values with no default are reset to their zero value. 97 func (o *ListSchedulesParams) WithDefaults() *ListSchedulesParams { 98 o.SetDefaults() 99 return o 100 } 101 102 // SetDefaults hydrates default values in the list schedules params (not the query body). 103 // 104 // All values with no default are reset to their zero value. 105 func (o *ListSchedulesParams) SetDefaults() { 106 var ( 107 pageDefault = int64(1) 108 109 pageSizeDefault = int64(10) 110 ) 111 112 val := ListSchedulesParams{ 113 Page: &pageDefault, 114 PageSize: &pageSizeDefault, 115 } 116 117 val.timeout = o.timeout 118 val.Context = o.Context 119 val.HTTPClient = o.HTTPClient 120 *o = val 121 } 122 123 // WithTimeout adds the timeout to the list schedules params 124 func (o *ListSchedulesParams) WithTimeout(timeout time.Duration) *ListSchedulesParams { 125 o.SetTimeout(timeout) 126 return o 127 } 128 129 // SetTimeout adds the timeout to the list schedules params 130 func (o *ListSchedulesParams) SetTimeout(timeout time.Duration) { 131 o.timeout = timeout 132 } 133 134 // WithContext adds the context to the list schedules params 135 func (o *ListSchedulesParams) WithContext(ctx context.Context) *ListSchedulesParams { 136 o.SetContext(ctx) 137 return o 138 } 139 140 // SetContext adds the context to the list schedules params 141 func (o *ListSchedulesParams) SetContext(ctx context.Context) { 142 o.Context = ctx 143 } 144 145 // WithHTTPClient adds the HTTPClient to the list schedules params 146 func (o *ListSchedulesParams) WithHTTPClient(client *http.Client) *ListSchedulesParams { 147 o.SetHTTPClient(client) 148 return o 149 } 150 151 // SetHTTPClient adds the HTTPClient to the list schedules params 152 func (o *ListSchedulesParams) SetHTTPClient(client *http.Client) { 153 o.HTTPClient = client 154 } 155 156 // WithXRequestID adds the xRequestID to the list schedules params 157 func (o *ListSchedulesParams) WithXRequestID(xRequestID *string) *ListSchedulesParams { 158 o.SetXRequestID(xRequestID) 159 return o 160 } 161 162 // SetXRequestID adds the xRequestId to the list schedules params 163 func (o *ListSchedulesParams) SetXRequestID(xRequestID *string) { 164 o.XRequestID = xRequestID 165 } 166 167 // WithPage adds the page to the list schedules params 168 func (o *ListSchedulesParams) WithPage(page *int64) *ListSchedulesParams { 169 o.SetPage(page) 170 return o 171 } 172 173 // SetPage adds the page to the list schedules params 174 func (o *ListSchedulesParams) SetPage(page *int64) { 175 o.Page = page 176 } 177 178 // WithPageSize adds the pageSize to the list schedules params 179 func (o *ListSchedulesParams) WithPageSize(pageSize *int64) *ListSchedulesParams { 180 o.SetPageSize(pageSize) 181 return o 182 } 183 184 // SetPageSize adds the pageSize to the list schedules params 185 func (o *ListSchedulesParams) SetPageSize(pageSize *int64) { 186 o.PageSize = pageSize 187 } 188 189 // WriteToRequest writes these params to a swagger request 190 func (o *ListSchedulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 191 192 if err := r.SetTimeout(o.timeout); err != nil { 193 return err 194 } 195 var res []error 196 197 if o.XRequestID != nil { 198 199 // header param X-Request-Id 200 if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil { 201 return err 202 } 203 } 204 205 if o.Page != nil { 206 207 // query param page 208 var qrPage int64 209 210 if o.Page != nil { 211 qrPage = *o.Page 212 } 213 qPage := swag.FormatInt64(qrPage) 214 if qPage != "" { 215 216 if err := r.SetQueryParam("page", qPage); err != nil { 217 return err 218 } 219 } 220 } 221 222 if o.PageSize != nil { 223 224 // query param page_size 225 var qrPageSize int64 226 227 if o.PageSize != nil { 228 qrPageSize = *o.PageSize 229 } 230 qPageSize := swag.FormatInt64(qrPageSize) 231 if qPageSize != "" { 232 233 if err := r.SetQueryParam("page_size", qPageSize); err != nil { 234 return err 235 } 236 } 237 } 238 239 if len(res) > 0 { 240 return errors.CompositeValidationError(res...) 241 } 242 return nil 243 }