github.com/dirkm/go-swagger@v0.19.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  // GetAccountUnauthorizedCode is the HTTP code returned for type GetAccountUnauthorized
    59  const GetAccountUnauthorizedCode int = 401
    60  
    61  /*GetAccountUnauthorized unauthorized access for a lack of authentication
    62  
    63  swagger:response getAccountUnauthorized
    64  */
    65  type GetAccountUnauthorized struct {
    66  }
    67  
    68  // NewGetAccountUnauthorized creates GetAccountUnauthorized with default headers values
    69  func NewGetAccountUnauthorized() *GetAccountUnauthorized {
    70  
    71  	return &GetAccountUnauthorized{}
    72  }
    73  
    74  // WriteResponse to the client
    75  func (o *GetAccountUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    76  
    77  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    78  
    79  	rw.WriteHeader(401)
    80  }
    81  
    82  /*GetAccountDefault other error response
    83  
    84  swagger:response getAccountDefault
    85  */
    86  type GetAccountDefault struct {
    87  	_statusCode int
    88  
    89  	/*
    90  	  In: Body
    91  	*/
    92  	Payload *models.Error `json:"body,omitempty"`
    93  }
    94  
    95  // NewGetAccountDefault creates GetAccountDefault with default headers values
    96  func NewGetAccountDefault(code int) *GetAccountDefault {
    97  	if code <= 0 {
    98  		code = 500
    99  	}
   100  
   101  	return &GetAccountDefault{
   102  		_statusCode: code,
   103  	}
   104  }
   105  
   106  // WithStatusCode adds the status to the get account default response
   107  func (o *GetAccountDefault) WithStatusCode(code int) *GetAccountDefault {
   108  	o._statusCode = code
   109  	return o
   110  }
   111  
   112  // SetStatusCode sets the status to the get account default response
   113  func (o *GetAccountDefault) SetStatusCode(code int) {
   114  	o._statusCode = code
   115  }
   116  
   117  // WithPayload adds the payload to the get account default response
   118  func (o *GetAccountDefault) WithPayload(payload *models.Error) *GetAccountDefault {
   119  	o.Payload = payload
   120  	return o
   121  }
   122  
   123  // SetPayload sets the payload to the get account default response
   124  func (o *GetAccountDefault) SetPayload(payload *models.Error) {
   125  	o.Payload = payload
   126  }
   127  
   128  // WriteResponse to the client
   129  func (o *GetAccountDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   130  
   131  	rw.WriteHeader(o._statusCode)
   132  	if o.Payload != nil {
   133  		payload := o.Payload
   134  		if err := producer.Produce(rw, payload); err != nil {
   135  			panic(err) // let the recovery middleware deal with this
   136  		}
   137  	}
   138  }