github.com/djarvur/go-swagger@v0.18.0/examples/task-tracker/client/tasks/add_comment_to_task_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package tasks
     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/swag"
    17  
    18  	strfmt "github.com/go-openapi/strfmt"
    19  )
    20  
    21  // NewAddCommentToTaskParams creates a new AddCommentToTaskParams object
    22  // with the default values initialized.
    23  func NewAddCommentToTaskParams() *AddCommentToTaskParams {
    24  	var ()
    25  	return &AddCommentToTaskParams{
    26  
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewAddCommentToTaskParamsWithTimeout creates a new AddCommentToTaskParams object
    32  // with the default values initialized, and the ability to set a timeout on a request
    33  func NewAddCommentToTaskParamsWithTimeout(timeout time.Duration) *AddCommentToTaskParams {
    34  	var ()
    35  	return &AddCommentToTaskParams{
    36  
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewAddCommentToTaskParamsWithContext creates a new AddCommentToTaskParams object
    42  // with the default values initialized, and the ability to set a context for a request
    43  func NewAddCommentToTaskParamsWithContext(ctx context.Context) *AddCommentToTaskParams {
    44  	var ()
    45  	return &AddCommentToTaskParams{
    46  
    47  		Context: ctx,
    48  	}
    49  }
    50  
    51  // NewAddCommentToTaskParamsWithHTTPClient creates a new AddCommentToTaskParams object
    52  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    53  func NewAddCommentToTaskParamsWithHTTPClient(client *http.Client) *AddCommentToTaskParams {
    54  	var ()
    55  	return &AddCommentToTaskParams{
    56  		HTTPClient: client,
    57  	}
    58  }
    59  
    60  /*AddCommentToTaskParams contains all the parameters to send to the API endpoint
    61  for the add comment to task operation typically these are written to a http.Request
    62  */
    63  type AddCommentToTaskParams struct {
    64  
    65  	/*Body
    66  	  The comment to add
    67  
    68  	*/
    69  	Body AddCommentToTaskBody
    70  	/*ID
    71  	  The id of the item
    72  
    73  	*/
    74  	ID int64
    75  
    76  	timeout    time.Duration
    77  	Context    context.Context
    78  	HTTPClient *http.Client
    79  }
    80  
    81  // WithTimeout adds the timeout to the add comment to task params
    82  func (o *AddCommentToTaskParams) WithTimeout(timeout time.Duration) *AddCommentToTaskParams {
    83  	o.SetTimeout(timeout)
    84  	return o
    85  }
    86  
    87  // SetTimeout adds the timeout to the add comment to task params
    88  func (o *AddCommentToTaskParams) SetTimeout(timeout time.Duration) {
    89  	o.timeout = timeout
    90  }
    91  
    92  // WithContext adds the context to the add comment to task params
    93  func (o *AddCommentToTaskParams) WithContext(ctx context.Context) *AddCommentToTaskParams {
    94  	o.SetContext(ctx)
    95  	return o
    96  }
    97  
    98  // SetContext adds the context to the add comment to task params
    99  func (o *AddCommentToTaskParams) SetContext(ctx context.Context) {
   100  	o.Context = ctx
   101  }
   102  
   103  // WithHTTPClient adds the HTTPClient to the add comment to task params
   104  func (o *AddCommentToTaskParams) WithHTTPClient(client *http.Client) *AddCommentToTaskParams {
   105  	o.SetHTTPClient(client)
   106  	return o
   107  }
   108  
   109  // SetHTTPClient adds the HTTPClient to the add comment to task params
   110  func (o *AddCommentToTaskParams) SetHTTPClient(client *http.Client) {
   111  	o.HTTPClient = client
   112  }
   113  
   114  // WithBody adds the body to the add comment to task params
   115  func (o *AddCommentToTaskParams) WithBody(body AddCommentToTaskBody) *AddCommentToTaskParams {
   116  	o.SetBody(body)
   117  	return o
   118  }
   119  
   120  // SetBody adds the body to the add comment to task params
   121  func (o *AddCommentToTaskParams) SetBody(body AddCommentToTaskBody) {
   122  	o.Body = body
   123  }
   124  
   125  // WithID adds the id to the add comment to task params
   126  func (o *AddCommentToTaskParams) WithID(id int64) *AddCommentToTaskParams {
   127  	o.SetID(id)
   128  	return o
   129  }
   130  
   131  // SetID adds the id to the add comment to task params
   132  func (o *AddCommentToTaskParams) SetID(id int64) {
   133  	o.ID = id
   134  }
   135  
   136  // WriteToRequest writes these params to a swagger request
   137  func (o *AddCommentToTaskParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   138  
   139  	if err := r.SetTimeout(o.timeout); err != nil {
   140  		return err
   141  	}
   142  	var res []error
   143  
   144  	if err := r.SetBodyParam(o.Body); err != nil {
   145  		return err
   146  	}
   147  
   148  	// path param id
   149  	if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil {
   150  		return err
   151  	}
   152  
   153  	if len(res) > 0 {
   154  		return errors.CompositeValidationError(res...)
   155  	}
   156  	return nil
   157  }