github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/client/external/get_contract_responses.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package external 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/runtime" 13 14 strfmt "github.com/go-openapi/strfmt" 15 16 models "github.com/aeternity/aepp-sdk-go/swagguard/node/models" 17 ) 18 19 // GetContractReader is a Reader for the GetContract structure. 20 type GetContractReader struct { 21 formats strfmt.Registry 22 } 23 24 // ReadResponse reads a server response into the received o. 25 func (o *GetContractReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 switch response.Code() { 27 28 case 200: 29 result := NewGetContractOK() 30 if err := result.readResponse(response, consumer, o.formats); err != nil { 31 return nil, err 32 } 33 return result, nil 34 35 case 400: 36 result := NewGetContractBadRequest() 37 if err := result.readResponse(response, consumer, o.formats); err != nil { 38 return nil, err 39 } 40 return nil, result 41 42 case 404: 43 result := NewGetContractNotFound() 44 if err := result.readResponse(response, consumer, o.formats); err != nil { 45 return nil, err 46 } 47 return nil, result 48 49 default: 50 return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 } 52 } 53 54 // NewGetContractOK creates a GetContractOK with default headers values 55 func NewGetContractOK() *GetContractOK { 56 return &GetContractOK{} 57 } 58 59 /*GetContractOK handles this case with default header values. 60 61 Successful operation 62 */ 63 type GetContractOK struct { 64 Payload *models.ContractObject 65 } 66 67 func (o *GetContractOK) Error() string { 68 return fmt.Sprintf("[GET /contracts/{pubkey}][%d] getContractOK %+v", 200, o.Payload) 69 } 70 71 func (o *GetContractOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 72 73 o.Payload = new(models.ContractObject) 74 75 // response payload 76 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 77 return err 78 } 79 80 return nil 81 } 82 83 // NewGetContractBadRequest creates a GetContractBadRequest with default headers values 84 func NewGetContractBadRequest() *GetContractBadRequest { 85 return &GetContractBadRequest{} 86 } 87 88 /*GetContractBadRequest handles this case with default header values. 89 90 Invalid pubkey 91 */ 92 type GetContractBadRequest struct { 93 Payload *models.Error 94 } 95 96 func (o *GetContractBadRequest) Error() string { 97 return fmt.Sprintf("[GET /contracts/{pubkey}][%d] getContractBadRequest %+v", 400, o.Payload) 98 } 99 100 func (o *GetContractBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 101 102 o.Payload = new(models.Error) 103 104 // response payload 105 if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 106 return err 107 } 108 109 return nil 110 } 111 112 // NewGetContractNotFound creates a GetContractNotFound with default headers values 113 func NewGetContractNotFound() *GetContractNotFound { 114 return &GetContractNotFound{} 115 } 116 117 /*GetContractNotFound handles this case with default header values. 118 119 Contract not found 120 */ 121 type GetContractNotFound struct { 122 } 123 124 func (o *GetContractNotFound) Error() string { 125 return fmt.Sprintf("[GET /contracts/{pubkey}][%d] getContractNotFound ", 404) 126 } 127 128 func (o *GetContractNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 129 130 return nil 131 }