github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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  	"github.com/go-openapi/strfmt"
    17  )
    18  
    19  // NewDestroyOneParams creates a new DestroyOneParams object,
    20  // with the default timeout for this client.
    21  //
    22  // Default values are not hydrated, since defaults are normally applied by the API server side.
    23  //
    24  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    25  func NewDestroyOneParams() *DestroyOneParams {
    26  	return &DestroyOneParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewDestroyOneParamsWithTimeout creates a new DestroyOneParams object
    32  // with the ability to set a timeout on a request.
    33  func NewDestroyOneParamsWithTimeout(timeout time.Duration) *DestroyOneParams {
    34  	return &DestroyOneParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewDestroyOneParamsWithContext creates a new DestroyOneParams object
    40  // with the ability to set a context for a request.
    41  func NewDestroyOneParamsWithContext(ctx context.Context) *DestroyOneParams {
    42  	return &DestroyOneParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewDestroyOneParamsWithHTTPClient creates a new DestroyOneParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewDestroyOneParamsWithHTTPClient(client *http.Client) *DestroyOneParams {
    50  	return &DestroyOneParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /*
    56  DestroyOneParams contains all the parameters to send to the API endpoint
    57  
    58  	for the destroy one operation.
    59  
    60  	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  // WithDefaults hydrates default values in the destroy one params (not the query body).
    73  //
    74  // All values with no default are reset to their zero value.
    75  func (o *DestroyOneParams) WithDefaults() *DestroyOneParams {
    76  	o.SetDefaults()
    77  	return o
    78  }
    79  
    80  // SetDefaults hydrates default values in the destroy one params (not the query body).
    81  //
    82  // All values with no default are reset to their zero value.
    83  func (o *DestroyOneParams) SetDefaults() {
    84  	// no default values defined for this parameter
    85  }
    86  
    87  // WithTimeout adds the timeout to the destroy one params
    88  func (o *DestroyOneParams) WithTimeout(timeout time.Duration) *DestroyOneParams {
    89  	o.SetTimeout(timeout)
    90  	return o
    91  }
    92  
    93  // SetTimeout adds the timeout to the destroy one params
    94  func (o *DestroyOneParams) SetTimeout(timeout time.Duration) {
    95  	o.timeout = timeout
    96  }
    97  
    98  // WithContext adds the context to the destroy one params
    99  func (o *DestroyOneParams) WithContext(ctx context.Context) *DestroyOneParams {
   100  	o.SetContext(ctx)
   101  	return o
   102  }
   103  
   104  // SetContext adds the context to the destroy one params
   105  func (o *DestroyOneParams) SetContext(ctx context.Context) {
   106  	o.Context = ctx
   107  }
   108  
   109  // WithHTTPClient adds the HTTPClient to the destroy one params
   110  func (o *DestroyOneParams) WithHTTPClient(client *http.Client) *DestroyOneParams {
   111  	o.SetHTTPClient(client)
   112  	return o
   113  }
   114  
   115  // SetHTTPClient adds the HTTPClient to the destroy one params
   116  func (o *DestroyOneParams) SetHTTPClient(client *http.Client) {
   117  	o.HTTPClient = client
   118  }
   119  
   120  // WithID adds the id to the destroy one params
   121  func (o *DestroyOneParams) WithID(id string) *DestroyOneParams {
   122  	o.SetID(id)
   123  	return o
   124  }
   125  
   126  // SetID adds the id to the destroy one params
   127  func (o *DestroyOneParams) SetID(id string) {
   128  	o.ID = id
   129  }
   130  
   131  // WriteToRequest writes these params to a swagger request
   132  func (o *DestroyOneParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   133  
   134  	if err := r.SetTimeout(o.timeout); err != nil {
   135  		return err
   136  	}
   137  	var res []error
   138  
   139  	// path param id
   140  	if err := r.SetPathParam("id", o.ID); err != nil {
   141  		return err
   142  	}
   143  
   144  	if len(res) > 0 {
   145  		return errors.CompositeValidationError(res...)
   146  	}
   147  	return nil
   148  }