github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/authentication/restapi/operations/customers/get_id_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package customers
     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/thetreep/go-swagger/examples/authentication/models"
    14  )
    15  
    16  // GetIDOKCode is the HTTP code returned for type GetIDOK
    17  const GetIDOKCode int = 200
    18  
    19  /*
    20  GetIDOK OK
    21  
    22  swagger:response getIdOK
    23  */
    24  type GetIDOK struct {
    25  
    26  	/*
    27  	  In: Body
    28  	*/
    29  	Payload *models.Customer `json:"body,omitempty"`
    30  }
    31  
    32  // NewGetIDOK creates GetIDOK with default headers values
    33  func NewGetIDOK() *GetIDOK {
    34  
    35  	return &GetIDOK{}
    36  }
    37  
    38  // WithPayload adds the payload to the get Id o k response
    39  func (o *GetIDOK) WithPayload(payload *models.Customer) *GetIDOK {
    40  	o.Payload = payload
    41  	return o
    42  }
    43  
    44  // SetPayload sets the payload to the get Id o k response
    45  func (o *GetIDOK) SetPayload(payload *models.Customer) {
    46  	o.Payload = payload
    47  }
    48  
    49  // WriteResponse to the client
    50  func (o *GetIDOK) 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  // GetIDUnauthorizedCode is the HTTP code returned for type GetIDUnauthorized
    62  const GetIDUnauthorizedCode int = 401
    63  
    64  /*
    65  GetIDUnauthorized unauthorized
    66  
    67  swagger:response getIdUnauthorized
    68  */
    69  type GetIDUnauthorized struct {
    70  
    71  	/*
    72  	  In: Body
    73  	*/
    74  	Payload *models.Error `json:"body,omitempty"`
    75  }
    76  
    77  // NewGetIDUnauthorized creates GetIDUnauthorized with default headers values
    78  func NewGetIDUnauthorized() *GetIDUnauthorized {
    79  
    80  	return &GetIDUnauthorized{}
    81  }
    82  
    83  // WithPayload adds the payload to the get Id unauthorized response
    84  func (o *GetIDUnauthorized) WithPayload(payload *models.Error) *GetIDUnauthorized {
    85  	o.Payload = payload
    86  	return o
    87  }
    88  
    89  // SetPayload sets the payload to the get Id unauthorized response
    90  func (o *GetIDUnauthorized) SetPayload(payload *models.Error) {
    91  	o.Payload = payload
    92  }
    93  
    94  // WriteResponse to the client
    95  func (o *GetIDUnauthorized) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    96  
    97  	rw.WriteHeader(401)
    98  	if o.Payload != nil {
    99  		payload := o.Payload
   100  		if err := producer.Produce(rw, payload); err != nil {
   101  			panic(err) // let the recovery middleware deal with this
   102  		}
   103  	}
   104  }
   105  
   106  // GetIDNotFoundCode is the HTTP code returned for type GetIDNotFound
   107  const GetIDNotFoundCode int = 404
   108  
   109  /*
   110  GetIDNotFound resource not found
   111  
   112  swagger:response getIdNotFound
   113  */
   114  type GetIDNotFound struct {
   115  
   116  	/*
   117  	  In: Body
   118  	*/
   119  	Payload *models.Error `json:"body,omitempty"`
   120  }
   121  
   122  // NewGetIDNotFound creates GetIDNotFound with default headers values
   123  func NewGetIDNotFound() *GetIDNotFound {
   124  
   125  	return &GetIDNotFound{}
   126  }
   127  
   128  // WithPayload adds the payload to the get Id not found response
   129  func (o *GetIDNotFound) WithPayload(payload *models.Error) *GetIDNotFound {
   130  	o.Payload = payload
   131  	return o
   132  }
   133  
   134  // SetPayload sets the payload to the get Id not found response
   135  func (o *GetIDNotFound) SetPayload(payload *models.Error) {
   136  	o.Payload = payload
   137  }
   138  
   139  // WriteResponse to the client
   140  func (o *GetIDNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   141  
   142  	rw.WriteHeader(404)
   143  	if o.Payload != nil {
   144  		payload := o.Payload
   145  		if err := producer.Produce(rw, payload); err != nil {
   146  			panic(err) // let the recovery middleware deal with this
   147  		}
   148  	}
   149  }
   150  
   151  /*
   152  GetIDDefault error
   153  
   154  swagger:response getIdDefault
   155  */
   156  type GetIDDefault struct {
   157  	_statusCode int
   158  
   159  	/*
   160  	  In: Body
   161  	*/
   162  	Payload *models.Error `json:"body,omitempty"`
   163  }
   164  
   165  // NewGetIDDefault creates GetIDDefault with default headers values
   166  func NewGetIDDefault(code int) *GetIDDefault {
   167  	if code <= 0 {
   168  		code = 500
   169  	}
   170  
   171  	return &GetIDDefault{
   172  		_statusCode: code,
   173  	}
   174  }
   175  
   176  // WithStatusCode adds the status to the get Id default response
   177  func (o *GetIDDefault) WithStatusCode(code int) *GetIDDefault {
   178  	o._statusCode = code
   179  	return o
   180  }
   181  
   182  // SetStatusCode sets the status to the get Id default response
   183  func (o *GetIDDefault) SetStatusCode(code int) {
   184  	o._statusCode = code
   185  }
   186  
   187  // WithPayload adds the payload to the get Id default response
   188  func (o *GetIDDefault) WithPayload(payload *models.Error) *GetIDDefault {
   189  	o.Payload = payload
   190  	return o
   191  }
   192  
   193  // SetPayload sets the payload to the get Id default response
   194  func (o *GetIDDefault) SetPayload(payload *models.Error) {
   195  	o.Payload = payload
   196  }
   197  
   198  // WriteResponse to the client
   199  func (o *GetIDDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   200  
   201  	rw.WriteHeader(o._statusCode)
   202  	if o.Payload != nil {
   203  		payload := o.Payload
   204  		if err := producer.Produce(rw, payload); err != nil {
   205  			panic(err) // let the recovery middleware deal with this
   206  		}
   207  	}
   208  }