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