github.com/circl-dev/go-swagger@v0.31.0/examples/stream-client/client/operations/chunked_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  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/strfmt"
    15  	"github.com/circl-dev/runtime"
    16  	cr "github.com/circl-dev/runtime/client"
    17  )
    18  
    19  // NewChunkedParams creates a new ChunkedParams 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 NewChunkedParams() *ChunkedParams {
    26  	return &ChunkedParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewChunkedParamsWithTimeout creates a new ChunkedParams object
    32  // with the ability to set a timeout on a request.
    33  func NewChunkedParamsWithTimeout(timeout time.Duration) *ChunkedParams {
    34  	return &ChunkedParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewChunkedParamsWithContext creates a new ChunkedParams object
    40  // with the ability to set a context for a request.
    41  func NewChunkedParamsWithContext(ctx context.Context) *ChunkedParams {
    42  	return &ChunkedParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewChunkedParamsWithHTTPClient creates a new ChunkedParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewChunkedParamsWithHTTPClient(client *http.Client) *ChunkedParams {
    50  	return &ChunkedParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /* ChunkedParams contains all the parameters to send to the API endpoint
    56     for the chunked operation.
    57  
    58     Typically these are written to a http.Request.
    59  */
    60  type ChunkedParams struct {
    61  	timeout    time.Duration
    62  	Context    context.Context
    63  	HTTPClient *http.Client
    64  }
    65  
    66  // WithDefaults hydrates default values in the chunked params (not the query body).
    67  //
    68  // All values with no default are reset to their zero value.
    69  func (o *ChunkedParams) WithDefaults() *ChunkedParams {
    70  	o.SetDefaults()
    71  	return o
    72  }
    73  
    74  // SetDefaults hydrates default values in the chunked params (not the query body).
    75  //
    76  // All values with no default are reset to their zero value.
    77  func (o *ChunkedParams) SetDefaults() {
    78  	// no default values defined for this parameter
    79  }
    80  
    81  // WithTimeout adds the timeout to the chunked params
    82  func (o *ChunkedParams) WithTimeout(timeout time.Duration) *ChunkedParams {
    83  	o.SetTimeout(timeout)
    84  	return o
    85  }
    86  
    87  // SetTimeout adds the timeout to the chunked params
    88  func (o *ChunkedParams) SetTimeout(timeout time.Duration) {
    89  	o.timeout = timeout
    90  }
    91  
    92  // WithContext adds the context to the chunked params
    93  func (o *ChunkedParams) WithContext(ctx context.Context) *ChunkedParams {
    94  	o.SetContext(ctx)
    95  	return o
    96  }
    97  
    98  // SetContext adds the context to the chunked params
    99  func (o *ChunkedParams) SetContext(ctx context.Context) {
   100  	o.Context = ctx
   101  }
   102  
   103  // WithHTTPClient adds the HTTPClient to the chunked params
   104  func (o *ChunkedParams) WithHTTPClient(client *http.Client) *ChunkedParams {
   105  	o.SetHTTPClient(client)
   106  	return o
   107  }
   108  
   109  // SetHTTPClient adds the HTTPClient to the chunked params
   110  func (o *ChunkedParams) SetHTTPClient(client *http.Client) {
   111  	o.HTTPClient = client
   112  }
   113  
   114  // WriteToRequest writes these params to a swagger request
   115  func (o *ChunkedParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   116  
   117  	if err := r.SetTimeout(o.timeout); err != nil {
   118  		return err
   119  	}
   120  	var res []error
   121  
   122  	if len(res) > 0 {
   123  		return errors.CompositeValidationError(res...)
   124  	}
   125  	return nil
   126  }