github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/generated/restapi/operations/user/get_user_by_name_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package user
     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/generated/models"
    14  )
    15  
    16  // GetUserByNameOKCode is the HTTP code returned for type GetUserByNameOK
    17  const GetUserByNameOKCode int = 200
    18  
    19  /*
    20  GetUserByNameOK successful operation
    21  
    22  swagger:response getUserByNameOK
    23  */
    24  type GetUserByNameOK struct {
    25  
    26  	/*
    27  	  In: Body
    28  	*/
    29  	Payload *models.User `json:"body,omitempty"`
    30  }
    31  
    32  // NewGetUserByNameOK creates GetUserByNameOK with default headers values
    33  func NewGetUserByNameOK() *GetUserByNameOK {
    34  
    35  	return &GetUserByNameOK{}
    36  }
    37  
    38  // WithPayload adds the payload to the get user by name o k response
    39  func (o *GetUserByNameOK) WithPayload(payload *models.User) *GetUserByNameOK {
    40  	o.Payload = payload
    41  	return o
    42  }
    43  
    44  // SetPayload sets the payload to the get user by name o k response
    45  func (o *GetUserByNameOK) SetPayload(payload *models.User) {
    46  	o.Payload = payload
    47  }
    48  
    49  // WriteResponse to the client
    50  func (o *GetUserByNameOK) 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  // GetUserByNameBadRequestCode is the HTTP code returned for type GetUserByNameBadRequest
    62  const GetUserByNameBadRequestCode int = 400
    63  
    64  /*
    65  GetUserByNameBadRequest Invalid username supplied
    66  
    67  swagger:response getUserByNameBadRequest
    68  */
    69  type GetUserByNameBadRequest struct {
    70  }
    71  
    72  // NewGetUserByNameBadRequest creates GetUserByNameBadRequest with default headers values
    73  func NewGetUserByNameBadRequest() *GetUserByNameBadRequest {
    74  
    75  	return &GetUserByNameBadRequest{}
    76  }
    77  
    78  // WriteResponse to the client
    79  func (o *GetUserByNameBadRequest) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
    80  
    81  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
    82  
    83  	rw.WriteHeader(400)
    84  }
    85  
    86  // GetUserByNameNotFoundCode is the HTTP code returned for type GetUserByNameNotFound
    87  const GetUserByNameNotFoundCode int = 404
    88  
    89  /*
    90  GetUserByNameNotFound User not found
    91  
    92  swagger:response getUserByNameNotFound
    93  */
    94  type GetUserByNameNotFound struct {
    95  }
    96  
    97  // NewGetUserByNameNotFound creates GetUserByNameNotFound with default headers values
    98  func NewGetUserByNameNotFound() *GetUserByNameNotFound {
    99  
   100  	return &GetUserByNameNotFound{}
   101  }
   102  
   103  // WriteResponse to the client
   104  func (o *GetUserByNameNotFound) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {
   105  
   106  	rw.Header().Del(runtime.HeaderContentType) //Remove Content-Type on empty responses
   107  
   108  	rw.WriteHeader(404)
   109  }