github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/client/pet/pet_delete_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package pet
     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/go-openapi/swag"
    16  	"github.com/circl-dev/runtime"
    17  	cr "github.com/circl-dev/runtime/client"
    18  )
    19  
    20  // NewPetDeleteParams creates a new PetDeleteParams object,
    21  // with the default timeout for this client.
    22  //
    23  // Default values are not hydrated, since defaults are normally applied by the API server side.
    24  //
    25  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    26  func NewPetDeleteParams() *PetDeleteParams {
    27  	return &PetDeleteParams{
    28  		timeout: cr.DefaultTimeout,
    29  	}
    30  }
    31  
    32  // NewPetDeleteParamsWithTimeout creates a new PetDeleteParams object
    33  // with the ability to set a timeout on a request.
    34  func NewPetDeleteParamsWithTimeout(timeout time.Duration) *PetDeleteParams {
    35  	return &PetDeleteParams{
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewPetDeleteParamsWithContext creates a new PetDeleteParams object
    41  // with the ability to set a context for a request.
    42  func NewPetDeleteParamsWithContext(ctx context.Context) *PetDeleteParams {
    43  	return &PetDeleteParams{
    44  		Context: ctx,
    45  	}
    46  }
    47  
    48  // NewPetDeleteParamsWithHTTPClient creates a new PetDeleteParams object
    49  // with the ability to set a custom HTTPClient for a request.
    50  func NewPetDeleteParamsWithHTTPClient(client *http.Client) *PetDeleteParams {
    51  	return &PetDeleteParams{
    52  		HTTPClient: client,
    53  	}
    54  }
    55  
    56  /* PetDeleteParams contains all the parameters to send to the API endpoint
    57     for the pet delete operation.
    58  
    59     Typically these are written to a http.Request.
    60  */
    61  type PetDeleteParams struct {
    62  
    63  	// APIKey.
    64  	APIKey *string
    65  
    66  	/* PetID.
    67  
    68  	   Pet id to delete
    69  
    70  	   Format: int64
    71  	*/
    72  	PetID int64
    73  
    74  	timeout    time.Duration
    75  	Context    context.Context
    76  	HTTPClient *http.Client
    77  }
    78  
    79  // WithDefaults hydrates default values in the pet delete params (not the query body).
    80  //
    81  // All values with no default are reset to their zero value.
    82  func (o *PetDeleteParams) WithDefaults() *PetDeleteParams {
    83  	o.SetDefaults()
    84  	return o
    85  }
    86  
    87  // SetDefaults hydrates default values in the pet delete params (not the query body).
    88  //
    89  // All values with no default are reset to their zero value.
    90  func (o *PetDeleteParams) SetDefaults() {
    91  	// no default values defined for this parameter
    92  }
    93  
    94  // WithTimeout adds the timeout to the pet delete params
    95  func (o *PetDeleteParams) WithTimeout(timeout time.Duration) *PetDeleteParams {
    96  	o.SetTimeout(timeout)
    97  	return o
    98  }
    99  
   100  // SetTimeout adds the timeout to the pet delete params
   101  func (o *PetDeleteParams) SetTimeout(timeout time.Duration) {
   102  	o.timeout = timeout
   103  }
   104  
   105  // WithContext adds the context to the pet delete params
   106  func (o *PetDeleteParams) WithContext(ctx context.Context) *PetDeleteParams {
   107  	o.SetContext(ctx)
   108  	return o
   109  }
   110  
   111  // SetContext adds the context to the pet delete params
   112  func (o *PetDeleteParams) SetContext(ctx context.Context) {
   113  	o.Context = ctx
   114  }
   115  
   116  // WithHTTPClient adds the HTTPClient to the pet delete params
   117  func (o *PetDeleteParams) WithHTTPClient(client *http.Client) *PetDeleteParams {
   118  	o.SetHTTPClient(client)
   119  	return o
   120  }
   121  
   122  // SetHTTPClient adds the HTTPClient to the pet delete params
   123  func (o *PetDeleteParams) SetHTTPClient(client *http.Client) {
   124  	o.HTTPClient = client
   125  }
   126  
   127  // WithAPIKey adds the aPIKey to the pet delete params
   128  func (o *PetDeleteParams) WithAPIKey(aPIKey *string) *PetDeleteParams {
   129  	o.SetAPIKey(aPIKey)
   130  	return o
   131  }
   132  
   133  // SetAPIKey adds the apiKey to the pet delete params
   134  func (o *PetDeleteParams) SetAPIKey(aPIKey *string) {
   135  	o.APIKey = aPIKey
   136  }
   137  
   138  // WithPetID adds the petID to the pet delete params
   139  func (o *PetDeleteParams) WithPetID(petID int64) *PetDeleteParams {
   140  	o.SetPetID(petID)
   141  	return o
   142  }
   143  
   144  // SetPetID adds the petId to the pet delete params
   145  func (o *PetDeleteParams) SetPetID(petID int64) {
   146  	o.PetID = petID
   147  }
   148  
   149  // WriteToRequest writes these params to a swagger request
   150  func (o *PetDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   151  
   152  	if err := r.SetTimeout(o.timeout); err != nil {
   153  		return err
   154  	}
   155  	var res []error
   156  
   157  	if o.APIKey != nil {
   158  
   159  		// header param api_key
   160  		if err := r.SetHeaderParam("api_key", *o.APIKey); err != nil {
   161  			return err
   162  		}
   163  	}
   164  
   165  	// path param petId
   166  	if err := r.SetPathParam("petId", swag.FormatInt64(o.PetID)); err != nil {
   167  		return err
   168  	}
   169  
   170  	if len(res) > 0 {
   171  		return errors.CompositeValidationError(res...)
   172  	}
   173  	return nil
   174  }