github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/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  	"github.com/go-openapi/strfmt"
    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  /*
    52  	PetDeleteNoContent describes a response with status code 204, with default header values.
    53  
    54  Deleted successfully
    55  */
    56  type PetDeleteNoContent struct {
    57  }
    58  
    59  // IsSuccess returns true when this pet delete no content response returns a 2xx status code
    60  func (o *PetDeleteNoContent) IsSuccess() bool {
    61  	return true
    62  }
    63  
    64  // IsRedirect returns true when this pet delete no content response returns a 3xx status code
    65  func (o *PetDeleteNoContent) IsRedirect() bool {
    66  	return false
    67  }
    68  
    69  // IsClientError returns true when this pet delete no content response returns a 4xx status code
    70  func (o *PetDeleteNoContent) IsClientError() bool {
    71  	return false
    72  }
    73  
    74  // IsServerError returns true when this pet delete no content response returns a 5xx status code
    75  func (o *PetDeleteNoContent) IsServerError() bool {
    76  	return false
    77  }
    78  
    79  // IsCode returns true when this pet delete no content response returns a 4xx status code
    80  func (o *PetDeleteNoContent) IsCode(code int) bool {
    81  	return code == 204
    82  }
    83  
    84  func (o *PetDeleteNoContent) Error() string {
    85  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNoContent ", 204)
    86  }
    87  
    88  func (o *PetDeleteNoContent) String() string {
    89  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNoContent ", 204)
    90  }
    91  
    92  func (o *PetDeleteNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    93  
    94  	return nil
    95  }
    96  
    97  // NewPetDeleteBadRequest creates a PetDeleteBadRequest with default headers values
    98  func NewPetDeleteBadRequest() *PetDeleteBadRequest {
    99  	return &PetDeleteBadRequest{}
   100  }
   101  
   102  /*
   103  	PetDeleteBadRequest describes a response with status code 400, with default header values.
   104  
   105  Invalid ID supplied
   106  */
   107  type PetDeleteBadRequest struct {
   108  }
   109  
   110  // IsSuccess returns true when this pet delete bad request response returns a 2xx status code
   111  func (o *PetDeleteBadRequest) IsSuccess() bool {
   112  	return false
   113  }
   114  
   115  // IsRedirect returns true when this pet delete bad request response returns a 3xx status code
   116  func (o *PetDeleteBadRequest) IsRedirect() bool {
   117  	return false
   118  }
   119  
   120  // IsClientError returns true when this pet delete bad request response returns a 4xx status code
   121  func (o *PetDeleteBadRequest) IsClientError() bool {
   122  	return true
   123  }
   124  
   125  // IsServerError returns true when this pet delete bad request response returns a 5xx status code
   126  func (o *PetDeleteBadRequest) IsServerError() bool {
   127  	return false
   128  }
   129  
   130  // IsCode returns true when this pet delete bad request response returns a 4xx status code
   131  func (o *PetDeleteBadRequest) IsCode(code int) bool {
   132  	return code == 400
   133  }
   134  
   135  func (o *PetDeleteBadRequest) Error() string {
   136  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteBadRequest ", 400)
   137  }
   138  
   139  func (o *PetDeleteBadRequest) String() string {
   140  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteBadRequest ", 400)
   141  }
   142  
   143  func (o *PetDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   144  
   145  	return nil
   146  }
   147  
   148  // NewPetDeleteNotFound creates a PetDeleteNotFound with default headers values
   149  func NewPetDeleteNotFound() *PetDeleteNotFound {
   150  	return &PetDeleteNotFound{}
   151  }
   152  
   153  /*
   154  	PetDeleteNotFound describes a response with status code 404, with default header values.
   155  
   156  Pet not found
   157  */
   158  type PetDeleteNotFound struct {
   159  }
   160  
   161  // IsSuccess returns true when this pet delete not found response returns a 2xx status code
   162  func (o *PetDeleteNotFound) IsSuccess() bool {
   163  	return false
   164  }
   165  
   166  // IsRedirect returns true when this pet delete not found response returns a 3xx status code
   167  func (o *PetDeleteNotFound) IsRedirect() bool {
   168  	return false
   169  }
   170  
   171  // IsClientError returns true when this pet delete not found response returns a 4xx status code
   172  func (o *PetDeleteNotFound) IsClientError() bool {
   173  	return true
   174  }
   175  
   176  // IsServerError returns true when this pet delete not found response returns a 5xx status code
   177  func (o *PetDeleteNotFound) IsServerError() bool {
   178  	return false
   179  }
   180  
   181  // IsCode returns true when this pet delete not found response returns a 4xx status code
   182  func (o *PetDeleteNotFound) IsCode(code int) bool {
   183  	return code == 404
   184  }
   185  
   186  func (o *PetDeleteNotFound) Error() string {
   187  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNotFound ", 404)
   188  }
   189  
   190  func (o *PetDeleteNotFound) String() string {
   191  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNotFound ", 404)
   192  }
   193  
   194  func (o *PetDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   195  
   196  	return nil
   197  }