github.com/sap/cf-mta-plugin@v2.6.3+incompatible/clients/restclient/operations/get_csrf_token_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package operations 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 "net/http" 10 "time" 11 12 "golang.org/x/net/context" 13 14 "github.com/go-openapi/errors" 15 "github.com/go-openapi/runtime" 16 cr "github.com/go-openapi/runtime/client" 17 18 strfmt "github.com/go-openapi/strfmt" 19 ) 20 21 // NewGetCsrfTokenParams creates a new GetCsrfTokenParams object 22 // with the default values initialized. 23 func NewGetCsrfTokenParams() *GetCsrfTokenParams { 24 25 return &GetCsrfTokenParams{ 26 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewGetCsrfTokenParamsWithTimeout creates a new GetCsrfTokenParams object 32 // with the default values initialized, and the ability to set a timeout on a request 33 func NewGetCsrfTokenParamsWithTimeout(timeout time.Duration) *GetCsrfTokenParams { 34 35 return &GetCsrfTokenParams{ 36 37 timeout: timeout, 38 } 39 } 40 41 // NewGetCsrfTokenParamsWithContext creates a new GetCsrfTokenParams object 42 // with the default values initialized, and the ability to set a context for a request 43 func NewGetCsrfTokenParamsWithContext(ctx context.Context) *GetCsrfTokenParams { 44 45 return &GetCsrfTokenParams{ 46 47 Context: ctx, 48 } 49 } 50 51 // NewGetCsrfTokenParamsWithHTTPClient creates a new GetCsrfTokenParams object 52 // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 func NewGetCsrfTokenParamsWithHTTPClient(client *http.Client) *GetCsrfTokenParams { 54 55 return &GetCsrfTokenParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /*GetCsrfTokenParams contains all the parameters to send to the API endpoint 61 for the get csrf token operation typically these are written to a http.Request 62 */ 63 type GetCsrfTokenParams struct { 64 timeout time.Duration 65 Context context.Context 66 HTTPClient *http.Client 67 } 68 69 // WithTimeout adds the timeout to the get csrf token params 70 func (o *GetCsrfTokenParams) WithTimeout(timeout time.Duration) *GetCsrfTokenParams { 71 o.SetTimeout(timeout) 72 return o 73 } 74 75 // SetTimeout adds the timeout to the get csrf token params 76 func (o *GetCsrfTokenParams) SetTimeout(timeout time.Duration) { 77 o.timeout = timeout 78 } 79 80 // WithContext adds the context to the get csrf token params 81 func (o *GetCsrfTokenParams) WithContext(ctx context.Context) *GetCsrfTokenParams { 82 o.SetContext(ctx) 83 return o 84 } 85 86 // SetContext adds the context to the get csrf token params 87 func (o *GetCsrfTokenParams) SetContext(ctx context.Context) { 88 o.Context = ctx 89 } 90 91 // WithHTTPClient adds the HTTPClient to the get csrf token params 92 func (o *GetCsrfTokenParams) WithHTTPClient(client *http.Client) *GetCsrfTokenParams { 93 o.SetHTTPClient(client) 94 return o 95 } 96 97 // SetHTTPClient adds the HTTPClient to the get csrf token params 98 func (o *GetCsrfTokenParams) SetHTTPClient(client *http.Client) { 99 o.HTTPClient = client 100 } 101 102 // WriteToRequest writes these params to a swagger request 103 func (o *GetCsrfTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 104 105 if err := r.SetTimeout(o.timeout); err != nil { 106 return err 107 } 108 var res []error 109 110 if len(res) > 0 { 111 return errors.CompositeValidationError(res...) 112 } 113 return nil 114 }