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