github.com/go-swagger/go-swagger@v0.31.0/examples/task-tracker/restapi/operations/tasks/get_task_details_responses.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  	"net/http"
    10  
    11  	"github.com/go-openapi/runtime"
    12  
    13  	"github.com/go-swagger/go-swagger/examples/task-tracker/models"
    14  )
    15  
    16  // GetTaskDetailsOKCode is the HTTP code returned for type GetTaskDetailsOK
    17  const GetTaskDetailsOKCode int = 200
    18  
    19  /*
    20  GetTaskDetailsOK Task details
    21  
    22  swagger:response getTaskDetailsOK
    23  */
    24  type GetTaskDetailsOK struct {
    25  
    26  	/*
    27  	  In: Body
    28  	*/
    29  	Payload *models.Task `json:"body,omitempty"`
    30  }
    31  
    32  // NewGetTaskDetailsOK creates GetTaskDetailsOK with default headers values
    33  func NewGetTaskDetailsOK() *GetTaskDetailsOK {
    34  
    35  	return &GetTaskDetailsOK{}
    36  }
    37  
    38  // WithPayload adds the payload to the get task details o k response
    39  func (o *GetTaskDetailsOK) WithPayload(payload *models.Task) *GetTaskDetailsOK {
    40  	o.Payload = payload
    41  	return o
    42  }
    43  
    44  // SetPayload sets the payload to the get task details o k response
    45  func (o *GetTaskDetailsOK) SetPayload(payload *models.Task) {
    46  	o.Payload = payload
    47  }
    48  
    49  // WriteResponse to the client
    50  func (o *GetTaskDetailsOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    51  
    52  	rw.WriteHeader(200)
    53  	if o.Payload != nil {
    54  		payload := o.Payload
    55  		if err := producer.Produce(rw, payload); err != nil {
    56  			panic(err) // let the recovery middleware deal with this
    57  		}
    58  	}
    59  }
    60  
    61  // GetTaskDetailsUnprocessableEntityCode is the HTTP code returned for type GetTaskDetailsUnprocessableEntity
    62  const GetTaskDetailsUnprocessableEntityCode int = 422
    63  
    64  /*
    65  GetTaskDetailsUnprocessableEntity Validation error
    66  
    67  swagger:response getTaskDetailsUnprocessableEntity
    68  */
    69  type GetTaskDetailsUnprocessableEntity struct {
    70  
    71  	/*
    72  	  In: Body
    73  	*/
    74  	Payload *models.ValidationError `json:"body,omitempty"`
    75  }
    76  
    77  // NewGetTaskDetailsUnprocessableEntity creates GetTaskDetailsUnprocessableEntity with default headers values
    78  func NewGetTaskDetailsUnprocessableEntity() *GetTaskDetailsUnprocessableEntity {
    79  
    80  	return &GetTaskDetailsUnprocessableEntity{}
    81  }
    82  
    83  // WithPayload adds the payload to the get task details unprocessable entity response
    84  func (o *GetTaskDetailsUnprocessableEntity) WithPayload(payload *models.ValidationError) *GetTaskDetailsUnprocessableEntity {
    85  	o.Payload = payload
    86  	return o
    87  }
    88  
    89  // SetPayload sets the payload to the get task details unprocessable entity response
    90  func (o *GetTaskDetailsUnprocessableEntity) SetPayload(payload *models.ValidationError) {
    91  	o.Payload = payload
    92  }
    93  
    94  // WriteResponse to the client
    95  func (o *GetTaskDetailsUnprocessableEntity) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    96  
    97  	rw.WriteHeader(422)
    98  	if o.Payload != nil {
    99  		payload := o.Payload
   100  		if err := producer.Produce(rw, payload); err != nil {
   101  			panic(err) // let the recovery middleware deal with this
   102  		}
   103  	}
   104  }
   105  
   106  /*
   107  GetTaskDetailsDefault Error response
   108  
   109  swagger:response getTaskDetailsDefault
   110  */
   111  type GetTaskDetailsDefault struct {
   112  	_statusCode int
   113  	/*
   114  
   115  	 */
   116  	XErrorCode string `json:"X-Error-Code"`
   117  
   118  	/*
   119  	  In: Body
   120  	*/
   121  	Payload *models.Error `json:"body,omitempty"`
   122  }
   123  
   124  // NewGetTaskDetailsDefault creates GetTaskDetailsDefault with default headers values
   125  func NewGetTaskDetailsDefault(code int) *GetTaskDetailsDefault {
   126  	if code <= 0 {
   127  		code = 500
   128  	}
   129  
   130  	return &GetTaskDetailsDefault{
   131  		_statusCode: code,
   132  	}
   133  }
   134  
   135  // WithStatusCode adds the status to the get task details default response
   136  func (o *GetTaskDetailsDefault) WithStatusCode(code int) *GetTaskDetailsDefault {
   137  	o._statusCode = code
   138  	return o
   139  }
   140  
   141  // SetStatusCode sets the status to the get task details default response
   142  func (o *GetTaskDetailsDefault) SetStatusCode(code int) {
   143  	o._statusCode = code
   144  }
   145  
   146  // WithXErrorCode adds the xErrorCode to the get task details default response
   147  func (o *GetTaskDetailsDefault) WithXErrorCode(xErrorCode string) *GetTaskDetailsDefault {
   148  	o.XErrorCode = xErrorCode
   149  	return o
   150  }
   151  
   152  // SetXErrorCode sets the xErrorCode to the get task details default response
   153  func (o *GetTaskDetailsDefault) SetXErrorCode(xErrorCode string) {
   154  	o.XErrorCode = xErrorCode
   155  }
   156  
   157  // WithPayload adds the payload to the get task details default response
   158  func (o *GetTaskDetailsDefault) WithPayload(payload *models.Error) *GetTaskDetailsDefault {
   159  	o.Payload = payload
   160  	return o
   161  }
   162  
   163  // SetPayload sets the payload to the get task details default response
   164  func (o *GetTaskDetailsDefault) SetPayload(payload *models.Error) {
   165  	o.Payload = payload
   166  }
   167  
   168  // WriteResponse to the client
   169  func (o *GetTaskDetailsDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   170  
   171  	// response header X-Error-Code
   172  
   173  	xErrorCode := o.XErrorCode
   174  	if xErrorCode != "" {
   175  		rw.Header().Set("X-Error-Code", xErrorCode)
   176  	}
   177  
   178  	rw.WriteHeader(o._statusCode)
   179  	if o.Payload != nil {
   180  		payload := o.Payload
   181  		if err := producer.Produce(rw, payload); err != nil {
   182  			panic(err) // let the recovery middleware deal with this
   183  		}
   184  	}
   185  }