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