github.com/kaisawind/go-swagger@v0.19.0/examples/todo-list/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  
    17  	strfmt "github.com/go-openapi/strfmt"
    18  )
    19  
    20  // NewDestroyOneParams creates a new DestroyOneParams object
    21  // with the default values initialized.
    22  func NewDestroyOneParams() *DestroyOneParams {
    23  	var ()
    24  	return &DestroyOneParams{
    25  
    26  		timeout: cr.DefaultTimeout,
    27  	}
    28  }
    29  
    30  // NewDestroyOneParamsWithTimeout creates a new DestroyOneParams object
    31  // with the default values initialized, and the ability to set a timeout on a request
    32  func NewDestroyOneParamsWithTimeout(timeout time.Duration) *DestroyOneParams {
    33  	var ()
    34  	return &DestroyOneParams{
    35  
    36  		timeout: timeout,
    37  	}
    38  }
    39  
    40  // NewDestroyOneParamsWithContext creates a new DestroyOneParams object
    41  // with the default values initialized, and the ability to set a context for a request
    42  func NewDestroyOneParamsWithContext(ctx context.Context) *DestroyOneParams {
    43  	var ()
    44  	return &DestroyOneParams{
    45  
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewDestroyOneParamsWithHTTPClient creates a new DestroyOneParams object
    51  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    52  func NewDestroyOneParamsWithHTTPClient(client *http.Client) *DestroyOneParams {
    53  	var ()
    54  	return &DestroyOneParams{
    55  		HTTPClient: client,
    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  }