github.com/go-swagger/go-swagger@v0.31.0/examples/cli/client/operations/put_test2766_responses.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     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  	"encoding/json"
    10  	"fmt"
    11  	"io"
    12  
    13  	"github.com/go-openapi/runtime"
    14  	"github.com/go-openapi/strfmt"
    15  
    16  	"github.com/go-swagger/go-swagger/examples/cli/models"
    17  )
    18  
    19  // PutTest2766Reader is a Reader for the PutTest2766 structure.
    20  type PutTest2766Reader struct {
    21  	formats strfmt.Registry
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *PutTest2766Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  	case 200:
    28  		result := NewPutTest2766OK()
    29  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    30  			return nil, err
    31  		}
    32  		return result, nil
    33  	default:
    34  		return nil, runtime.NewAPIError("[PUT /test2766] PutTest2766", response, response.Code())
    35  	}
    36  }
    37  
    38  // NewPutTest2766OK creates a PutTest2766OK with default headers values
    39  func NewPutTest2766OK() *PutTest2766OK {
    40  	return &PutTest2766OK{}
    41  }
    42  
    43  /*
    44  PutTest2766OK describes a response with status code 200, with default header values.
    45  
    46  test issue #2766
    47  */
    48  type PutTest2766OK struct {
    49  	Payload *models.GithubReactions
    50  }
    51  
    52  // IsSuccess returns true when this put test2766 o k response has a 2xx status code
    53  func (o *PutTest2766OK) IsSuccess() bool {
    54  	return true
    55  }
    56  
    57  // IsRedirect returns true when this put test2766 o k response has a 3xx status code
    58  func (o *PutTest2766OK) IsRedirect() bool {
    59  	return false
    60  }
    61  
    62  // IsClientError returns true when this put test2766 o k response has a 4xx status code
    63  func (o *PutTest2766OK) IsClientError() bool {
    64  	return false
    65  }
    66  
    67  // IsServerError returns true when this put test2766 o k response has a 5xx status code
    68  func (o *PutTest2766OK) IsServerError() bool {
    69  	return false
    70  }
    71  
    72  // IsCode returns true when this put test2766 o k response a status code equal to that given
    73  func (o *PutTest2766OK) IsCode(code int) bool {
    74  	return code == 200
    75  }
    76  
    77  // Code gets the status code for the put test2766 o k response
    78  func (o *PutTest2766OK) Code() int {
    79  	return 200
    80  }
    81  
    82  func (o *PutTest2766OK) Error() string {
    83  	payload, _ := json.Marshal(o.Payload)
    84  	return fmt.Sprintf("[PUT /test2766][%d] putTest2766OK %s", 200, payload)
    85  }
    86  
    87  func (o *PutTest2766OK) String() string {
    88  	payload, _ := json.Marshal(o.Payload)
    89  	return fmt.Sprintf("[PUT /test2766][%d] putTest2766OK %s", 200, payload)
    90  }
    91  
    92  func (o *PutTest2766OK) GetPayload() *models.GithubReactions {
    93  	return o.Payload
    94  }
    95  
    96  func (o *PutTest2766OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    97  
    98  	o.Payload = new(models.GithubReactions)
    99  
   100  	// response payload
   101  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   102  		return err
   103  	}
   104  
   105  	return nil
   106  }