github.com/circl-dev/go-swagger@v0.31.0/examples/contributed-templates/stratoscale/client/pet/pet_upload_image_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  	"io"
    11  
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/circl-dev/runtime"
    14  
    15  	"github.com/circl-dev/go-swagger/examples/contributed-templates/stratoscale/models"
    16  )
    17  
    18  // PetUploadImageReader is a Reader for the PetUploadImage structure.
    19  type PetUploadImageReader struct {
    20  	formats strfmt.Registry
    21  }
    22  
    23  // ReadResponse reads a server response into the received o.
    24  func (o *PetUploadImageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    25  	switch response.Code() {
    26  	case 200:
    27  		result := NewPetUploadImageOK()
    28  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    29  			return nil, err
    30  		}
    31  		return result, nil
    32  	default:
    33  		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
    34  	}
    35  }
    36  
    37  // NewPetUploadImageOK creates a PetUploadImageOK with default headers values
    38  func NewPetUploadImageOK() *PetUploadImageOK {
    39  	return &PetUploadImageOK{}
    40  }
    41  
    42  /* PetUploadImageOK describes a response with status code 200, with default header values.
    43  
    44  successful operation
    45  */
    46  type PetUploadImageOK struct {
    47  	Payload *models.APIResponse
    48  }
    49  
    50  func (o *PetUploadImageOK) Error() string {
    51  	return fmt.Sprintf("[POST /pet/{petId}/image][%d] petUploadImageOK  %+v", 200, o.Payload)
    52  }
    53  func (o *PetUploadImageOK) GetPayload() *models.APIResponse {
    54  	return o.Payload
    55  }
    56  
    57  func (o *PetUploadImageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    58  
    59  	o.Payload = new(models.APIResponse)
    60  
    61  	// response payload
    62  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
    63  		return err
    64  	}
    65  
    66  	return nil
    67  }