github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/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("[DELETE /pet/{petId}] PetDelete", 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 has 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 has 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 has 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 has 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 a status code equal to that given
    80  func (o *PetDeleteNoContent) IsCode(code int) bool {
    81  	return code == 204
    82  }
    83  
    84  // Code gets the status code for the pet delete no content response
    85  func (o *PetDeleteNoContent) Code() int {
    86  	return 204
    87  }
    88  
    89  func (o *PetDeleteNoContent) Error() string {
    90  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNoContent", 204)
    91  }
    92  
    93  func (o *PetDeleteNoContent) String() string {
    94  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNoContent", 204)
    95  }
    96  
    97  func (o *PetDeleteNoContent) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    98  
    99  	return nil
   100  }
   101  
   102  // NewPetDeleteBadRequest creates a PetDeleteBadRequest with default headers values
   103  func NewPetDeleteBadRequest() *PetDeleteBadRequest {
   104  	return &PetDeleteBadRequest{}
   105  }
   106  
   107  /*
   108  PetDeleteBadRequest describes a response with status code 400, with default header values.
   109  
   110  Invalid ID supplied
   111  */
   112  type PetDeleteBadRequest struct {
   113  }
   114  
   115  // IsSuccess returns true when this pet delete bad request response has a 2xx status code
   116  func (o *PetDeleteBadRequest) IsSuccess() bool {
   117  	return false
   118  }
   119  
   120  // IsRedirect returns true when this pet delete bad request response has a 3xx status code
   121  func (o *PetDeleteBadRequest) IsRedirect() bool {
   122  	return false
   123  }
   124  
   125  // IsClientError returns true when this pet delete bad request response has a 4xx status code
   126  func (o *PetDeleteBadRequest) IsClientError() bool {
   127  	return true
   128  }
   129  
   130  // IsServerError returns true when this pet delete bad request response has a 5xx status code
   131  func (o *PetDeleteBadRequest) IsServerError() bool {
   132  	return false
   133  }
   134  
   135  // IsCode returns true when this pet delete bad request response a status code equal to that given
   136  func (o *PetDeleteBadRequest) IsCode(code int) bool {
   137  	return code == 400
   138  }
   139  
   140  // Code gets the status code for the pet delete bad request response
   141  func (o *PetDeleteBadRequest) Code() int {
   142  	return 400
   143  }
   144  
   145  func (o *PetDeleteBadRequest) Error() string {
   146  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteBadRequest", 400)
   147  }
   148  
   149  func (o *PetDeleteBadRequest) String() string {
   150  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteBadRequest", 400)
   151  }
   152  
   153  func (o *PetDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   154  
   155  	return nil
   156  }
   157  
   158  // NewPetDeleteNotFound creates a PetDeleteNotFound with default headers values
   159  func NewPetDeleteNotFound() *PetDeleteNotFound {
   160  	return &PetDeleteNotFound{}
   161  }
   162  
   163  /*
   164  PetDeleteNotFound describes a response with status code 404, with default header values.
   165  
   166  Pet not found
   167  */
   168  type PetDeleteNotFound struct {
   169  }
   170  
   171  // IsSuccess returns true when this pet delete not found response has a 2xx status code
   172  func (o *PetDeleteNotFound) IsSuccess() bool {
   173  	return false
   174  }
   175  
   176  // IsRedirect returns true when this pet delete not found response has a 3xx status code
   177  func (o *PetDeleteNotFound) IsRedirect() bool {
   178  	return false
   179  }
   180  
   181  // IsClientError returns true when this pet delete not found response has a 4xx status code
   182  func (o *PetDeleteNotFound) IsClientError() bool {
   183  	return true
   184  }
   185  
   186  // IsServerError returns true when this pet delete not found response has a 5xx status code
   187  func (o *PetDeleteNotFound) IsServerError() bool {
   188  	return false
   189  }
   190  
   191  // IsCode returns true when this pet delete not found response a status code equal to that given
   192  func (o *PetDeleteNotFound) IsCode(code int) bool {
   193  	return code == 404
   194  }
   195  
   196  // Code gets the status code for the pet delete not found response
   197  func (o *PetDeleteNotFound) Code() int {
   198  	return 404
   199  }
   200  
   201  func (o *PetDeleteNotFound) Error() string {
   202  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNotFound", 404)
   203  }
   204  
   205  func (o *PetDeleteNotFound) String() string {
   206  	return fmt.Sprintf("[DELETE /pet/{petId}][%d] petDeleteNotFound", 404)
   207  }
   208  
   209  func (o *PetDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   210  
   211  	return nil
   212  }