github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/client/pet/pet_delete_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package pet
     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  	"fmt"
    10  
    11  	"github.com/go-openapi/strfmt"
    12  	"github.com/circl-dev/runtime"
    13  )
    14  
    15  // PetDeleteReader is a Reader for the PetDelete structure.
    16  type PetDeleteReader struct {
    17  	formats strfmt.Registry
    18  }
    19  
    20  // ReadResponse reads a server response into the received o.
    21  func (o *PetDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    22  	switch response.Code() {
    23  	case 204:
    24  		result := NewPetDeleteNoContent()
    25  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    26  			return nil, err
    27  		}
    28  		return result, nil
    29  	case 400:
    30  		result := NewPetDeleteBadRequest()
    31  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    32  			return nil, err
    33  		}
    34  		return nil, result
    35  	case 404:
    36  		result := NewPetDeleteNotFound()
    37  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    38  			return nil, err
    39  		}
    40  		return nil, result
    41  	default:
    42  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    43  	}
    44  }
    45  
    46  // NewPetDeleteNoContent creates a PetDeleteNoContent with default headers values
    47  func NewPetDeleteNoContent() *PetDeleteNoContent {
    48  	return &PetDeleteNoContent{}
    49  }
    50  
    51  /* PetDeleteNoContent describes a response with status code 204, with default header values.
    52  
    53  Deleted successfully
    54  */
    55  type PetDeleteNoContent struct {
    56  }
    57  
    58  func (o *PetDeleteNoContent) Error() string {
    59  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNoContent ", 204)
    60  }
    61  
    62  func (o *PetDeleteNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    63  
    64  	return nil
    65  }
    66  
    67  // NewPetDeleteBadRequest creates a PetDeleteBadRequest with default headers values
    68  func NewPetDeleteBadRequest() *PetDeleteBadRequest {
    69  	return &PetDeleteBadRequest{}
    70  }
    71  
    72  /* PetDeleteBadRequest describes a response with status code 400, with default header values.
    73  
    74  Invalid ID supplied
    75  */
    76  type PetDeleteBadRequest struct {
    77  }
    78  
    79  func (o *PetDeleteBadRequest) Error() string {
    80  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteBadRequest ", 400)
    81  }
    82  
    83  func (o *PetDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    84  
    85  	return nil
    86  }
    87  
    88  // NewPetDeleteNotFound creates a PetDeleteNotFound with default headers values
    89  func NewPetDeleteNotFound() *PetDeleteNotFound {
    90  	return &PetDeleteNotFound{}
    91  }
    92  
    93  /* PetDeleteNotFound describes a response with status code 404, with default header values.
    94  
    95  Pet not found
    96  */
    97  type PetDeleteNotFound struct {
    98  }
    99  
   100  func (o *PetDeleteNotFound) Error() string {
   101  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNotFound ", 404)
   102  }
   103  
   104  func (o *PetDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   105  
   106  	return nil
   107  }