github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/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/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/strfmt"
    17  	"github.com/go-openapi/swag"
    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  /*
    57  PetDeleteParams contains all the parameters to send to the API endpoint
    58  
    59  	for the pet delete operation.
    60  
    61  	Typically these are written to a http.Request.
    62  */
    63  type PetDeleteParams struct {
    64  
    65  	// APIKey.
    66  	APIKey *string
    67  
    68  	/* PetID.
    69  
    70  	   Pet id to delete
    71  
    72  	   Format: int64
    73  	*/
    74  	PetID int64
    75  
    76  	timeout    time.Duration
    77  	Context    context.Context
    78  	HTTPClient *http.Client
    79  }
    80  
    81  // WithDefaults hydrates default values in the pet delete params (not the query body).
    82  //
    83  // All values with no default are reset to their zero value.
    84  func (o *PetDeleteParams) WithDefaults() *PetDeleteParams {
    85  	o.SetDefaults()
    86  	return o
    87  }
    88  
    89  // SetDefaults hydrates default values in the pet delete params (not the query body).
    90  //
    91  // All values with no default are reset to their zero value.
    92  func (o *PetDeleteParams) SetDefaults() {
    93  	// no default values defined for this parameter
    94  }
    95  
    96  // WithTimeout adds the timeout to the pet delete params
    97  func (o *PetDeleteParams) WithTimeout(timeout time.Duration) *PetDeleteParams {
    98  	o.SetTimeout(timeout)
    99  	return o
   100  }
   101  
   102  // SetTimeout adds the timeout to the pet delete params
   103  func (o *PetDeleteParams) SetTimeout(timeout time.Duration) {
   104  	o.timeout = timeout
   105  }
   106  
   107  // WithContext adds the context to the pet delete params
   108  func (o *PetDeleteParams) WithContext(ctx context.Context) *PetDeleteParams {
   109  	o.SetContext(ctx)
   110  	return o
   111  }
   112  
   113  // SetContext adds the context to the pet delete params
   114  func (o *PetDeleteParams) SetContext(ctx context.Context) {
   115  	o.Context = ctx
   116  }
   117  
   118  // WithHTTPClient adds the HTTPClient to the pet delete params
   119  func (o *PetDeleteParams) WithHTTPClient(client *http.Client) *PetDeleteParams {
   120  	o.SetHTTPClient(client)
   121  	return o
   122  }
   123  
   124  // SetHTTPClient adds the HTTPClient to the pet delete params
   125  func (o *PetDeleteParams) SetHTTPClient(client *http.Client) {
   126  	o.HTTPClient = client
   127  }
   128  
   129  // WithAPIKey adds the aPIKey to the pet delete params
   130  func (o *PetDeleteParams) WithAPIKey(aPIKey *string) *PetDeleteParams {
   131  	o.SetAPIKey(aPIKey)
   132  	return o
   133  }
   134  
   135  // SetAPIKey adds the apiKey to the pet delete params
   136  func (o *PetDeleteParams) SetAPIKey(aPIKey *string) {
   137  	o.APIKey = aPIKey
   138  }
   139  
   140  // WithPetID adds the petID to the pet delete params
   141  func (o *PetDeleteParams) WithPetID(petID int64) *PetDeleteParams {
   142  	o.SetPetID(petID)
   143  	return o
   144  }
   145  
   146  // SetPetID adds the petId to the pet delete params
   147  func (o *PetDeleteParams) SetPetID(petID int64) {
   148  	o.PetID = petID
   149  }
   150  
   151  // WriteToRequest writes these params to a swagger request
   152  func (o *PetDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   153  
   154  	if err := r.SetTimeout(o.timeout); err != nil {
   155  		return err
   156  	}
   157  	var res []error
   158  
   159  	if o.APIKey != nil {
   160  
   161  		// header param api_key
   162  		if err := r.SetHeaderParam("api_key", *o.APIKey); err != nil {
   163  			return err
   164  		}
   165  	}
   166  
   167  	// path param petId
   168  	if err := r.SetPathParam("petId", swag.FormatInt64(o.PetID)); err != nil {
   169  		return err
   170  	}
   171  
   172  	if len(res) > 0 {
   173  		return errors.CompositeValidationError(res...)
   174  	}
   175  	return nil
   176  }