github.com/kaisawind/go-swagger@v0.19.0/examples/generated/restapi/operations/user/login_user_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package user
     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  
    14  // LoginUserOKCode is the HTTP code returned for type LoginUserOK
    15  const LoginUserOKCode int = 200
    16  
    17  /*LoginUserOK successful operation
    18  
    19  swagger:response loginUserOK
    20  */
    21  type LoginUserOK struct {
    22  
    23  	/*
    24  	  In: Body
    25  	*/
    26  	Payload string `json:"body,omitempty"`
    27  }
    28  
    29  // NewLoginUserOK creates LoginUserOK with default headers values
    30  func NewLoginUserOK() *LoginUserOK {
    31  
    32  	return &LoginUserOK{}
    33  }
    34  
    35  // WithPayload adds the payload to the login user o k response
    36  func (o *LoginUserOK) WithPayload(payload string) *LoginUserOK {
    37  	o.Payload = payload
    38  	return o
    39  }
    40  
    41  // SetPayload sets the payload to the login user o k response
    42  func (o *LoginUserOK) SetPayload(payload string) {
    43  	o.Payload = payload
    44  }
    45  
    46  // WriteResponse to the client
    47  func (o *LoginUserOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    48  
    49  	rw.WriteHeader(200)
    50  	payload := o.Payload
    51  	if err := producer.Produce(rw, payload); err != nil {
    52  		panic(err) // let the recovery middleware deal with this
    53  	}
    54  }
    55  
    56  // LoginUserBadRequestCode is the HTTP code returned for type LoginUserBadRequest
    57  const LoginUserBadRequestCode int = 400
    58  
    59  /*LoginUserBadRequest Invalid username/password supplied
    60  
    61  swagger:response loginUserBadRequest
    62  */
    63  type LoginUserBadRequest struct {
    64  }
    65  
    66  // NewLoginUserBadRequest creates LoginUserBadRequest with default headers values
    67  func NewLoginUserBadRequest() *LoginUserBadRequest {
    68  
    69  	return &LoginUserBadRequest{}
    70  }
    71  
    72  // WriteResponse to the client
    73  func (o *LoginUserBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    74  
    75  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    76  
    77  	rw.WriteHeader(400)
    78  }