github.com/djarvur/go-swagger@v0.18.0/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package pet 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 // NewPetDeleteParams creates a new PetDeleteParams object 22 // with the default values initialized. 23 func NewPetDeleteParams() *PetDeleteParams { 24 var () 25 return &PetDeleteParams{ 26 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewPetDeleteParamsWithTimeout creates a new PetDeleteParams object 32 // with the default values initialized, and the ability to set a timeout on a request 33 func NewPetDeleteParamsWithTimeout(timeout time.Duration) *PetDeleteParams { 34 var () 35 return &PetDeleteParams{ 36 37 timeout: timeout, 38 } 39 } 40 41 // NewPetDeleteParamsWithContext creates a new PetDeleteParams object 42 // with the default values initialized, and the ability to set a context for a request 43 func NewPetDeleteParamsWithContext(ctx context.Context) *PetDeleteParams { 44 var () 45 return &PetDeleteParams{ 46 47 Context: ctx, 48 } 49 } 50 51 // NewPetDeleteParamsWithHTTPClient creates a new PetDeleteParams object 52 // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 func NewPetDeleteParamsWithHTTPClient(client *http.Client) *PetDeleteParams { 54 var () 55 return &PetDeleteParams{ 56 HTTPClient: client, 57 } 58 } 59 60 /*PetDeleteParams contains all the parameters to send to the API endpoint 61 for the pet delete operation typically these are written to a http.Request 62 */ 63 type PetDeleteParams struct { 64 65 /*APIKey*/ 66 APIKey *string 67 /*PetID 68 Pet id to delete 69 70 */ 71 PetID int64 72 73 timeout time.Duration 74 Context context.Context 75 HTTPClient *http.Client 76 } 77 78 // WithTimeout adds the timeout to the pet delete params 79 func (o *PetDeleteParams) WithTimeout(timeout time.Duration) *PetDeleteParams { 80 o.SetTimeout(timeout) 81 return o 82 } 83 84 // SetTimeout adds the timeout to the pet delete params 85 func (o *PetDeleteParams) SetTimeout(timeout time.Duration) { 86 o.timeout = timeout 87 } 88 89 // WithContext adds the context to the pet delete params 90 func (o *PetDeleteParams) WithContext(ctx context.Context) *PetDeleteParams { 91 o.SetContext(ctx) 92 return o 93 } 94 95 // SetContext adds the context to the pet delete params 96 func (o *PetDeleteParams) SetContext(ctx context.Context) { 97 o.Context = ctx 98 } 99 100 // WithHTTPClient adds the HTTPClient to the pet delete params 101 func (o *PetDeleteParams) WithHTTPClient(client *http.Client) *PetDeleteParams { 102 o.SetHTTPClient(client) 103 return o 104 } 105 106 // SetHTTPClient adds the HTTPClient to the pet delete params 107 func (o *PetDeleteParams) SetHTTPClient(client *http.Client) { 108 o.HTTPClient = client 109 } 110 111 // WithAPIKey adds the aPIKey to the pet delete params 112 func (o *PetDeleteParams) WithAPIKey(aPIKey *string) *PetDeleteParams { 113 o.SetAPIKey(aPIKey) 114 return o 115 } 116 117 // SetAPIKey adds the apiKey to the pet delete params 118 func (o *PetDeleteParams) SetAPIKey(aPIKey *string) { 119 o.APIKey = aPIKey 120 } 121 122 // WithPetID adds the petID to the pet delete params 123 func (o *PetDeleteParams) WithPetID(petID int64) *PetDeleteParams { 124 o.SetPetID(petID) 125 return o 126 } 127 128 // SetPetID adds the petId to the pet delete params 129 func (o *PetDeleteParams) SetPetID(petID int64) { 130 o.PetID = petID 131 } 132 133 // WriteToRequest writes these params to a swagger request 134 func (o *PetDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 135 136 if err := r.SetTimeout(o.timeout); err != nil { 137 return err 138 } 139 var res []error 140 141 if o.APIKey != nil { 142 143 // header param api_key 144 if err := r.SetHeaderParam("api_key", *o.APIKey); err != nil { 145 return err 146 } 147 148 } 149 150 // path param petId 151 if err := r.SetPathParam("petId", swag.FormatInt64(o.PetID)); err != nil { 152 return err 153 } 154 155 if len(res) > 0 { 156 return errors.CompositeValidationError(res...) 157 } 158 return nil 159 }