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