github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/todo-list-strict/client/todos/destroy_one_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package todos
     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  
    19  // NewDestroyOneParams creates a new DestroyOneParams object
    20  // with the default values initialized.
    21  func NewDestroyOneParams() *DestroyOneParams {
    22  	var ()
    23  	return &DestroyOneParams{
    24  
    25  		timeout: cr.DefaultTimeout,
    26  	}
    27  }
    28  
    29  // NewDestroyOneParamsWithTimeout creates a new DestroyOneParams object
    30  // with the default values initialized, and the ability to set a timeout on a request
    31  func NewDestroyOneParamsWithTimeout(timeout time.Duration) *DestroyOneParams {
    32  	var ()
    33  	return &DestroyOneParams{
    34  
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewDestroyOneParamsWithContext creates a new DestroyOneParams object
    40  // with the default values initialized, and the ability to set a context for a request
    41  func NewDestroyOneParamsWithContext(ctx context.Context) *DestroyOneParams {
    42  	var ()
    43  	return &DestroyOneParams{
    44  
    45  		Context: ctx,
    46  	}
    47  }
    48  
    49  // NewDestroyOneParamsWithHTTPClient creates a new DestroyOneParams object
    50  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    51  func NewDestroyOneParamsWithHTTPClient(client *http.Client) *DestroyOneParams {
    52  	var ()
    53  	return &DestroyOneParams{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  DestroyOneParams contains all the parameters to send to the API endpoint
    60  for the destroy one operation typically these are written to a http.Request
    61  */
    62  type DestroyOneParams struct {
    63  
    64  	/*ID*/
    65  	ID string
    66  
    67  	timeout    time.Duration
    68  	Context    context.Context
    69  	HTTPClient *http.Client
    70  }
    71  
    72  // WithTimeout adds the timeout to the destroy one params
    73  func (o *DestroyOneParams) WithTimeout(timeout time.Duration) *DestroyOneParams {
    74  	o.SetTimeout(timeout)
    75  	return o
    76  }
    77  
    78  // SetTimeout adds the timeout to the destroy one params
    79  func (o *DestroyOneParams) SetTimeout(timeout time.Duration) {
    80  	o.timeout = timeout
    81  }
    82  
    83  // WithContext adds the context to the destroy one params
    84  func (o *DestroyOneParams) WithContext(ctx context.Context) *DestroyOneParams {
    85  	o.SetContext(ctx)
    86  	return o
    87  }
    88  
    89  // SetContext adds the context to the destroy one params
    90  func (o *DestroyOneParams) SetContext(ctx context.Context) {
    91  	o.Context = ctx
    92  }
    93  
    94  // WithHTTPClient adds the HTTPClient to the destroy one params
    95  func (o *DestroyOneParams) WithHTTPClient(client *http.Client) *DestroyOneParams {
    96  	o.SetHTTPClient(client)
    97  	return o
    98  }
    99  
   100  // SetHTTPClient adds the HTTPClient to the destroy one params
   101  func (o *DestroyOneParams) SetHTTPClient(client *http.Client) {
   102  	o.HTTPClient = client
   103  }
   104  
   105  // WithID adds the id to the destroy one params
   106  func (o *DestroyOneParams) WithID(id string) *DestroyOneParams {
   107  	o.SetID(id)
   108  	return o
   109  }
   110  
   111  // SetID adds the id to the destroy one params
   112  func (o *DestroyOneParams) SetID(id string) {
   113  	o.ID = id
   114  }
   115  
   116  // WriteToRequest writes these params to a swagger request
   117  func (o *DestroyOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   118  
   119  	if err := r.SetTimeout(o.timeout); err != nil {
   120  		return err
   121  	}
   122  	var res []error
   123  
   124  	// path param id
   125  	if err := r.SetPathParam("id", o.ID); err != nil {
   126  		return err
   127  	}
   128  
   129  	if len(res) > 0 {
   130  		return errors.CompositeValidationError(res...)
   131  	}
   132  	return nil
   133  }