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