github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/invoices/calculate_tax_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  // NewCalculateTaxParams creates a new CalculateTaxParams 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 NewCalculateTaxParams() *CalculateTaxParams {
    28  	return &CalculateTaxParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewCalculateTaxParamsWithTimeout creates a new CalculateTaxParams object
    34  // with the ability to set a timeout on a request.
    35  func NewCalculateTaxParamsWithTimeout(timeout time.Duration) *CalculateTaxParams {
    36  	return &CalculateTaxParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewCalculateTaxParamsWithContext creates a new CalculateTaxParams object
    42  // with the ability to set a context for a request.
    43  func NewCalculateTaxParamsWithContext(ctx context.Context) *CalculateTaxParams {
    44  	return &CalculateTaxParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewCalculateTaxParamsWithHTTPClient creates a new CalculateTaxParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewCalculateTaxParamsWithHTTPClient(client *http.Client) *CalculateTaxParams {
    52  	return &CalculateTaxParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /* CalculateTaxParams contains all the parameters to send to the API endpoint
    58     for the calculate tax operation.
    59  
    60     Typically these are written to a http.Request.
    61  */
    62  type CalculateTaxParams struct {
    63  
    64  	// TaxOptions.
    65  	TaxOptions *mono_models.TaxOptions
    66  
    67  	timeout    time.Duration
    68  	Context    context.Context
    69  	HTTPClient *http.Client
    70  }
    71  
    72  // WithDefaults hydrates default values in the calculate tax params (not the query body).
    73  //
    74  // All values with no default are reset to their zero value.
    75  func (o *CalculateTaxParams) WithDefaults() *CalculateTaxParams {
    76  	o.SetDefaults()
    77  	return o
    78  }
    79  
    80  // SetDefaults hydrates default values in the calculate tax params (not the query body).
    81  //
    82  // All values with no default are reset to their zero value.
    83  func (o *CalculateTaxParams) SetDefaults() {
    84  	// no default values defined for this parameter
    85  }
    86  
    87  // WithTimeout adds the timeout to the calculate tax params
    88  func (o *CalculateTaxParams) WithTimeout(timeout time.Duration) *CalculateTaxParams {
    89  	o.SetTimeout(timeout)
    90  	return o
    91  }
    92  
    93  // SetTimeout adds the timeout to the calculate tax params
    94  func (o *CalculateTaxParams) SetTimeout(timeout time.Duration) {
    95  	o.timeout = timeout
    96  }
    97  
    98  // WithContext adds the context to the calculate tax params
    99  func (o *CalculateTaxParams) WithContext(ctx context.Context) *CalculateTaxParams {
   100  	o.SetContext(ctx)
   101  	return o
   102  }
   103  
   104  // SetContext adds the context to the calculate tax params
   105  func (o *CalculateTaxParams) SetContext(ctx context.Context) {
   106  	o.Context = ctx
   107  }
   108  
   109  // WithHTTPClient adds the HTTPClient to the calculate tax params
   110  func (o *CalculateTaxParams) WithHTTPClient(client *http.Client) *CalculateTaxParams {
   111  	o.SetHTTPClient(client)
   112  	return o
   113  }
   114  
   115  // SetHTTPClient adds the HTTPClient to the calculate tax params
   116  func (o *CalculateTaxParams) SetHTTPClient(client *http.Client) {
   117  	o.HTTPClient = client
   118  }
   119  
   120  // WithTaxOptions adds the taxOptions to the calculate tax params
   121  func (o *CalculateTaxParams) WithTaxOptions(taxOptions *mono_models.TaxOptions) *CalculateTaxParams {
   122  	o.SetTaxOptions(taxOptions)
   123  	return o
   124  }
   125  
   126  // SetTaxOptions adds the taxOptions to the calculate tax params
   127  func (o *CalculateTaxParams) SetTaxOptions(taxOptions *mono_models.TaxOptions) {
   128  	o.TaxOptions = taxOptions
   129  }
   130  
   131  // WriteToRequest writes these params to a swagger request
   132  func (o *CalculateTaxParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   133  
   134  	if err := r.SetTimeout(o.timeout); err != nil {
   135  		return err
   136  	}
   137  	var res []error
   138  	if o.TaxOptions != nil {
   139  		if err := r.SetBodyParam(o.TaxOptions); err != nil {
   140  			return err
   141  		}
   142  	}
   143  
   144  	if len(res) > 0 {
   145  		return errors.CompositeValidationError(res...)
   146  	}
   147  	return nil
   148  }