github.com/djarvur/go-swagger@v0.18.0/examples/authentication/restapi/operations/customers/get_id_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package customers
     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/authentication/models"
    14  )
    15  
    16  // GetIDOKCode is the HTTP code returned for type GetIDOK
    17  const GetIDOKCode int = 200
    18  
    19  /*GetIDOK OK
    20  
    21  swagger:response getIdOK
    22  */
    23  type GetIDOK struct {
    24  
    25  	/*
    26  	  In: Body
    27  	*/
    28  	Payload *models.Customer `json:"body,omitempty"`
    29  }
    30  
    31  // NewGetIDOK creates GetIDOK with default headers values
    32  func NewGetIDOK() *GetIDOK {
    33  
    34  	return &GetIDOK{}
    35  }
    36  
    37  // WithPayload adds the payload to the get Id o k response
    38  func (o *GetIDOK) WithPayload(payload *models.Customer) *GetIDOK {
    39  	o.Payload = payload
    40  	return o
    41  }
    42  
    43  // SetPayload sets the payload to the get Id o k response
    44  func (o *GetIDOK) SetPayload(payload *models.Customer) {
    45  	o.Payload = payload
    46  }
    47  
    48  // WriteResponse to the client
    49  func (o *GetIDOK) 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  // GetIDUnauthorizedCode is the HTTP code returned for type GetIDUnauthorized
    61  const GetIDUnauthorizedCode int = 401
    62  
    63  /*GetIDUnauthorized unauthorized
    64  
    65  swagger:response getIdUnauthorized
    66  */
    67  type GetIDUnauthorized struct {
    68  
    69  	/*
    70  	  In: Body
    71  	*/
    72  	Payload *models.Error `json:"body,omitempty"`
    73  }
    74  
    75  // NewGetIDUnauthorized creates GetIDUnauthorized with default headers values
    76  func NewGetIDUnauthorized() *GetIDUnauthorized {
    77  
    78  	return &GetIDUnauthorized{}
    79  }
    80  
    81  // WithPayload adds the payload to the get Id unauthorized response
    82  func (o *GetIDUnauthorized) WithPayload(payload *models.Error) *GetIDUnauthorized {
    83  	o.Payload = payload
    84  	return o
    85  }
    86  
    87  // SetPayload sets the payload to the get Id unauthorized response
    88  func (o *GetIDUnauthorized) SetPayload(payload *models.Error) {
    89  	o.Payload = payload
    90  }
    91  
    92  // WriteResponse to the client
    93  func (o *GetIDUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    94  
    95  	rw.WriteHeader(401)
    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  // GetIDNotFoundCode is the HTTP code returned for type GetIDNotFound
   105  const GetIDNotFoundCode int = 404
   106  
   107  /*GetIDNotFound resource not found
   108  
   109  swagger:response getIdNotFound
   110  */
   111  type GetIDNotFound struct {
   112  
   113  	/*
   114  	  In: Body
   115  	*/
   116  	Payload *models.Error `json:"body,omitempty"`
   117  }
   118  
   119  // NewGetIDNotFound creates GetIDNotFound with default headers values
   120  func NewGetIDNotFound() *GetIDNotFound {
   121  
   122  	return &GetIDNotFound{}
   123  }
   124  
   125  // WithPayload adds the payload to the get Id not found response
   126  func (o *GetIDNotFound) WithPayload(payload *models.Error) *GetIDNotFound {
   127  	o.Payload = payload
   128  	return o
   129  }
   130  
   131  // SetPayload sets the payload to the get Id not found response
   132  func (o *GetIDNotFound) SetPayload(payload *models.Error) {
   133  	o.Payload = payload
   134  }
   135  
   136  // WriteResponse to the client
   137  func (o *GetIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   138  
   139  	rw.WriteHeader(404)
   140  	if o.Payload != nil {
   141  		payload := o.Payload
   142  		if err := producer.Produce(rw, payload); err != nil {
   143  			panic(err) // let the recovery middleware deal with this
   144  		}
   145  	}
   146  }
   147  
   148  /*GetIDDefault error
   149  
   150  swagger:response getIdDefault
   151  */
   152  type GetIDDefault struct {
   153  	_statusCode int
   154  
   155  	/*
   156  	  In: Body
   157  	*/
   158  	Payload *models.Error `json:"body,omitempty"`
   159  }
   160  
   161  // NewGetIDDefault creates GetIDDefault with default headers values
   162  func NewGetIDDefault(code int) *GetIDDefault {
   163  	if code <= 0 {
   164  		code = 500
   165  	}
   166  
   167  	return &GetIDDefault{
   168  		_statusCode: code,
   169  	}
   170  }
   171  
   172  // WithStatusCode adds the status to the get Id default response
   173  func (o *GetIDDefault) WithStatusCode(code int) *GetIDDefault {
   174  	o._statusCode = code
   175  	return o
   176  }
   177  
   178  // SetStatusCode sets the status to the get Id default response
   179  func (o *GetIDDefault) SetStatusCode(code int) {
   180  	o._statusCode = code
   181  }
   182  
   183  // WithPayload adds the payload to the get Id default response
   184  func (o *GetIDDefault) WithPayload(payload *models.Error) *GetIDDefault {
   185  	o.Payload = payload
   186  	return o
   187  }
   188  
   189  // SetPayload sets the payload to the get Id default response
   190  func (o *GetIDDefault) SetPayload(payload *models.Error) {
   191  	o.Payload = payload
   192  }
   193  
   194  // WriteResponse to the client
   195  func (o *GetIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   196  
   197  	rw.WriteHeader(o._statusCode)
   198  	if o.Payload != nil {
   199  		payload := o.Payload
   200  		if err := producer.Produce(rw, payload); err != nil {
   201  			panic(err) // let the recovery middleware deal with this
   202  		}
   203  	}
   204  }