github.com/go-swagger/go-swagger@v0.31.0/examples/oauth2/restapi/operations/get_login_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package operations 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/oauth2/models" 14 ) 15 16 // GetLoginOKCode is the HTTP code returned for type GetLoginOK 17 const GetLoginOKCode int = 200 18 19 /* 20 GetLoginOK login 21 22 swagger:response getLoginOK 23 */ 24 type GetLoginOK struct { 25 26 /* 27 In: Body 28 */ 29 Payload *GetLoginOKBody `json:"body,omitempty"` 30 } 31 32 // NewGetLoginOK creates GetLoginOK with default headers values 33 func NewGetLoginOK() *GetLoginOK { 34 35 return &GetLoginOK{} 36 } 37 38 // WithPayload adds the payload to the get login o k response 39 func (o *GetLoginOK) WithPayload(payload *GetLoginOKBody) *GetLoginOK { 40 o.Payload = payload 41 return o 42 } 43 44 // SetPayload sets the payload to the get login o k response 45 func (o *GetLoginOK) SetPayload(payload *GetLoginOKBody) { 46 o.Payload = payload 47 } 48 49 // WriteResponse to the client 50 func (o *GetLoginOK) 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 /* 62 GetLoginDefault error 63 64 swagger:response getLoginDefault 65 */ 66 type GetLoginDefault struct { 67 _statusCode int 68 69 /* 70 In: Body 71 */ 72 Payload *models.Error `json:"body,omitempty"` 73 } 74 75 // NewGetLoginDefault creates GetLoginDefault with default headers values 76 func NewGetLoginDefault(code int) *GetLoginDefault { 77 if code <= 0 { 78 code = 500 79 } 80 81 return &GetLoginDefault{ 82 _statusCode: code, 83 } 84 } 85 86 // WithStatusCode adds the status to the get login default response 87 func (o *GetLoginDefault) WithStatusCode(code int) *GetLoginDefault { 88 o._statusCode = code 89 return o 90 } 91 92 // SetStatusCode sets the status to the get login default response 93 func (o *GetLoginDefault) SetStatusCode(code int) { 94 o._statusCode = code 95 } 96 97 // WithPayload adds the payload to the get login default response 98 func (o *GetLoginDefault) WithPayload(payload *models.Error) *GetLoginDefault { 99 o.Payload = payload 100 return o 101 } 102 103 // SetPayload sets the payload to the get login default response 104 func (o *GetLoginDefault) SetPayload(payload *models.Error) { 105 o.Payload = payload 106 } 107 108 // WriteResponse to the client 109 func (o *GetLoginDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 110 111 rw.WriteHeader(o._statusCode) 112 if o.Payload != nil { 113 payload := o.Payload 114 if err := producer.Produce(rw, payload); err != nil { 115 panic(err) // let the recovery middleware deal with this 116 } 117 } 118 }