github.com/djarvur/go-swagger@v0.18.0/examples/composed-auth/restapi/operations/get_account_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 models "github.com/go-swagger/go-swagger/examples/composed-auth/models" 14 ) 15 16 // GetAccountOKCode is the HTTP code returned for type GetAccountOK 17 const GetAccountOKCode int = 200 18 19 /*GetAccountOK registered user personal account infos 20 21 swagger:response getAccountOK 22 */ 23 type GetAccountOK struct { 24 25 /* 26 In: Body 27 */ 28 Payload interface{} `json:"body,omitempty"` 29 } 30 31 // NewGetAccountOK creates GetAccountOK with default headers values 32 func NewGetAccountOK() *GetAccountOK { 33 34 return &GetAccountOK{} 35 } 36 37 // WithPayload adds the payload to the get account o k response 38 func (o *GetAccountOK) WithPayload(payload interface{}) *GetAccountOK { 39 o.Payload = payload 40 return o 41 } 42 43 // SetPayload sets the payload to the get account o k response 44 func (o *GetAccountOK) SetPayload(payload interface{}) { 45 o.Payload = payload 46 } 47 48 // WriteResponse to the client 49 func (o *GetAccountOK) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 50 51 rw.WriteHeader(200) 52 payload := o.Payload 53 if err := producer.Produce(rw, payload); err != nil { 54 panic(err) // let the recovery middleware deal with this 55 } 56 57 } 58 59 // GetAccountUnauthorizedCode is the HTTP code returned for type GetAccountUnauthorized 60 const GetAccountUnauthorizedCode int = 401 61 62 /*GetAccountUnauthorized unauthorized access for a lack of authentication 63 64 swagger:response getAccountUnauthorized 65 */ 66 type GetAccountUnauthorized struct { 67 } 68 69 // NewGetAccountUnauthorized creates GetAccountUnauthorized with default headers values 70 func NewGetAccountUnauthorized() *GetAccountUnauthorized { 71 72 return &GetAccountUnauthorized{} 73 } 74 75 // WriteResponse to the client 76 func (o *GetAccountUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 77 78 rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses 79 80 rw.WriteHeader(401) 81 } 82 83 /*GetAccountDefault other error response 84 85 swagger:response getAccountDefault 86 */ 87 type GetAccountDefault struct { 88 _statusCode int 89 90 /* 91 In: Body 92 */ 93 Payload *models.Error `json:"body,omitempty"` 94 } 95 96 // NewGetAccountDefault creates GetAccountDefault with default headers values 97 func NewGetAccountDefault(code int) *GetAccountDefault { 98 if code <= 0 { 99 code = 500 100 } 101 102 return &GetAccountDefault{ 103 _statusCode: code, 104 } 105 } 106 107 // WithStatusCode adds the status to the get account default response 108 func (o *GetAccountDefault) WithStatusCode(code int) *GetAccountDefault { 109 o._statusCode = code 110 return o 111 } 112 113 // SetStatusCode sets the status to the get account default response 114 func (o *GetAccountDefault) SetStatusCode(code int) { 115 o._statusCode = code 116 } 117 118 // WithPayload adds the payload to the get account default response 119 func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault { 120 o.Payload = payload 121 return o 122 } 123 124 // SetPayload sets the payload to the get account default response 125 func (o *GetAccountDefault) SetPayload(payload *models.Error) { 126 o.Payload = payload 127 } 128 129 // WriteResponse to the client 130 func (o *GetAccountDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) { 131 132 rw.WriteHeader(o._statusCode) 133 if o.Payload != nil { 134 payload := o.Payload 135 if err := producer.Produce(rw, payload); err != nil { 136 panic(err) // let the recovery middleware deal with this 137 } 138 } 139 }