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