github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/authentication/client/customers/get_id_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package customers
     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/thetreep/go-swagger/examples/authentication/models"
    19  )
    20  
    21  // NewGetIDParams creates a new GetIDParams 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 NewGetIDParams() *GetIDParams {
    28  	return &GetIDParams{
    29  		timeout: cr.DefaultTimeout,
    30  	}
    31  }
    32  
    33  // NewGetIDParamsWithTimeout creates a new GetIDParams object
    34  // with the ability to set a timeout on a request.
    35  func NewGetIDParamsWithTimeout(timeout time.Duration) *GetIDParams {
    36  	return &GetIDParams{
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewGetIDParamsWithContext creates a new GetIDParams object
    42  // with the ability to set a context for a request.
    43  func NewGetIDParamsWithContext(ctx context.Context) *GetIDParams {
    44  	return &GetIDParams{
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewGetIDParamsWithHTTPClient creates a new GetIDParams object
    50  // with the ability to set a custom HTTPClient for a request.
    51  func NewGetIDParamsWithHTTPClient(client *http.Client) *GetIDParams {
    52  	return &GetIDParams{
    53  		HTTPClient: client,
    54  	}
    55  }
    56  
    57  /*
    58  GetIDParams contains all the parameters to send to the API endpoint
    59  
    60  	for the get Id operation.
    61  
    62  	Typically these are written to a http.Request.
    63  */
    64  type GetIDParams struct {
    65  
    66  	// Info.
    67  	Info *models.SocialID
    68  
    69  	timeout    time.Duration
    70  	Context    context.Context
    71  	HTTPClient *http.Client
    72  }
    73  
    74  // WithDefaults hydrates default values in the get Id params (not the query body).
    75  //
    76  // All values with no default are reset to their zero value.
    77  func (o *GetIDParams) WithDefaults() *GetIDParams {
    78  	o.SetDefaults()
    79  	return o
    80  }
    81  
    82  // SetDefaults hydrates default values in the get Id params (not the query body).
    83  //
    84  // All values with no default are reset to their zero value.
    85  func (o *GetIDParams) SetDefaults() {
    86  	// no default values defined for this parameter
    87  }
    88  
    89  // WithTimeout adds the timeout to the get Id params
    90  func (o *GetIDParams) WithTimeout(timeout time.Duration) *GetIDParams {
    91  	o.SetTimeout(timeout)
    92  	return o
    93  }
    94  
    95  // SetTimeout adds the timeout to the get Id params
    96  func (o *GetIDParams) SetTimeout(timeout time.Duration) {
    97  	o.timeout = timeout
    98  }
    99  
   100  // WithContext adds the context to the get Id params
   101  func (o *GetIDParams) WithContext(ctx context.Context) *GetIDParams {
   102  	o.SetContext(ctx)
   103  	return o
   104  }
   105  
   106  // SetContext adds the context to the get Id params
   107  func (o *GetIDParams) SetContext(ctx context.Context) {
   108  	o.Context = ctx
   109  }
   110  
   111  // WithHTTPClient adds the HTTPClient to the get Id params
   112  func (o *GetIDParams) WithHTTPClient(client *http.Client) *GetIDParams {
   113  	o.SetHTTPClient(client)
   114  	return o
   115  }
   116  
   117  // SetHTTPClient adds the HTTPClient to the get Id params
   118  func (o *GetIDParams) SetHTTPClient(client *http.Client) {
   119  	o.HTTPClient = client
   120  }
   121  
   122  // WithInfo adds the info to the get Id params
   123  func (o *GetIDParams) WithInfo(info *models.SocialID) *GetIDParams {
   124  	o.SetInfo(info)
   125  	return o
   126  }
   127  
   128  // SetInfo adds the info to the get Id params
   129  func (o *GetIDParams) SetInfo(info *models.SocialID) {
   130  	o.Info = info
   131  }
   132  
   133  // WriteToRequest writes these params to a swagger request
   134  func (o *GetIDParams) 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  	if o.Info != nil {
   141  		if err := r.SetBodyParam(o.Info); err != nil {
   142  			return err
   143  		}
   144  	}
   145  
   146  	if len(res) > 0 {
   147  		return errors.CompositeValidationError(res...)
   148  	}
   149  	return nil
   150  }