github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/invoices/cancel_subscription_parameters.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package invoices 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 ) 18 19 // NewCancelSubscriptionParams creates a new CancelSubscriptionParams object, 20 // with the default timeout for this client. 21 // 22 // Default values are not hydrated, since defaults are normally applied by the API server side. 23 // 24 // To enforce default values in parameter, use SetDefaults or WithDefaults. 25 func NewCancelSubscriptionParams() *CancelSubscriptionParams { 26 return &CancelSubscriptionParams{ 27 timeout: cr.DefaultTimeout, 28 } 29 } 30 31 // NewCancelSubscriptionParamsWithTimeout creates a new CancelSubscriptionParams object 32 // with the ability to set a timeout on a request. 33 func NewCancelSubscriptionParamsWithTimeout(timeout time.Duration) *CancelSubscriptionParams { 34 return &CancelSubscriptionParams{ 35 timeout: timeout, 36 } 37 } 38 39 // NewCancelSubscriptionParamsWithContext creates a new CancelSubscriptionParams object 40 // with the ability to set a context for a request. 41 func NewCancelSubscriptionParamsWithContext(ctx context.Context) *CancelSubscriptionParams { 42 return &CancelSubscriptionParams{ 43 Context: ctx, 44 } 45 } 46 47 // NewCancelSubscriptionParamsWithHTTPClient creates a new CancelSubscriptionParams object 48 // with the ability to set a custom HTTPClient for a request. 49 func NewCancelSubscriptionParamsWithHTTPClient(client *http.Client) *CancelSubscriptionParams { 50 return &CancelSubscriptionParams{ 51 HTTPClient: client, 52 } 53 } 54 55 /* CancelSubscriptionParams contains all the parameters to send to the API endpoint 56 for the cancel subscription operation. 57 58 Typically these are written to a http.Request. 59 */ 60 type CancelSubscriptionParams struct { 61 62 /* IdentifierType. 63 64 what kind of thing the provided organizationIdentifier is 65 66 Default: "URLname" 67 */ 68 IdentifierType *string 69 70 /* OrganizationIdentifier. 71 72 identifier (URLname, by default) of the desired organization 73 */ 74 OrganizationIdentifier string 75 76 timeout time.Duration 77 Context context.Context 78 HTTPClient *http.Client 79 } 80 81 // WithDefaults hydrates default values in the cancel subscription params (not the query body). 82 // 83 // All values with no default are reset to their zero value. 84 func (o *CancelSubscriptionParams) WithDefaults() *CancelSubscriptionParams { 85 o.SetDefaults() 86 return o 87 } 88 89 // SetDefaults hydrates default values in the cancel subscription params (not the query body). 90 // 91 // All values with no default are reset to their zero value. 92 func (o *CancelSubscriptionParams) SetDefaults() { 93 var ( 94 identifierTypeDefault = string("URLname") 95 ) 96 97 val := CancelSubscriptionParams{ 98 IdentifierType: &identifierTypeDefault, 99 } 100 101 val.timeout = o.timeout 102 val.Context = o.Context 103 val.HTTPClient = o.HTTPClient 104 *o = val 105 } 106 107 // WithTimeout adds the timeout to the cancel subscription params 108 func (o *CancelSubscriptionParams) WithTimeout(timeout time.Duration) *CancelSubscriptionParams { 109 o.SetTimeout(timeout) 110 return o 111 } 112 113 // SetTimeout adds the timeout to the cancel subscription params 114 func (o *CancelSubscriptionParams) SetTimeout(timeout time.Duration) { 115 o.timeout = timeout 116 } 117 118 // WithContext adds the context to the cancel subscription params 119 func (o *CancelSubscriptionParams) WithContext(ctx context.Context) *CancelSubscriptionParams { 120 o.SetContext(ctx) 121 return o 122 } 123 124 // SetContext adds the context to the cancel subscription params 125 func (o *CancelSubscriptionParams) SetContext(ctx context.Context) { 126 o.Context = ctx 127 } 128 129 // WithHTTPClient adds the HTTPClient to the cancel subscription params 130 func (o *CancelSubscriptionParams) WithHTTPClient(client *http.Client) *CancelSubscriptionParams { 131 o.SetHTTPClient(client) 132 return o 133 } 134 135 // SetHTTPClient adds the HTTPClient to the cancel subscription params 136 func (o *CancelSubscriptionParams) SetHTTPClient(client *http.Client) { 137 o.HTTPClient = client 138 } 139 140 // WithIdentifierType adds the identifierType to the cancel subscription params 141 func (o *CancelSubscriptionParams) WithIdentifierType(identifierType *string) *CancelSubscriptionParams { 142 o.SetIdentifierType(identifierType) 143 return o 144 } 145 146 // SetIdentifierType adds the identifierType to the cancel subscription params 147 func (o *CancelSubscriptionParams) SetIdentifierType(identifierType *string) { 148 o.IdentifierType = identifierType 149 } 150 151 // WithOrganizationIdentifier adds the organizationIdentifier to the cancel subscription params 152 func (o *CancelSubscriptionParams) WithOrganizationIdentifier(organizationIdentifier string) *CancelSubscriptionParams { 153 o.SetOrganizationIdentifier(organizationIdentifier) 154 return o 155 } 156 157 // SetOrganizationIdentifier adds the organizationIdentifier to the cancel subscription params 158 func (o *CancelSubscriptionParams) SetOrganizationIdentifier(organizationIdentifier string) { 159 o.OrganizationIdentifier = organizationIdentifier 160 } 161 162 // WriteToRequest writes these params to a swagger request 163 func (o *CancelSubscriptionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 164 165 if err := r.SetTimeout(o.timeout); err != nil { 166 return err 167 } 168 var res []error 169 170 if o.IdentifierType != nil { 171 172 // query param identifierType 173 var qrIdentifierType string 174 175 if o.IdentifierType != nil { 176 qrIdentifierType = *o.IdentifierType 177 } 178 qIdentifierType := qrIdentifierType 179 if qIdentifierType != "" { 180 181 if err := r.SetQueryParam("identifierType", qIdentifierType); err != nil { 182 return err 183 } 184 } 185 } 186 187 // path param organizationIdentifier 188 if err := r.SetPathParam("organizationIdentifier", o.OrganizationIdentifier); err != nil { 189 return err 190 } 191 192 if len(res) > 0 { 193 return errors.CompositeValidationError(res...) 194 } 195 return nil 196 }