github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/client/external/get_current_key_block_hash_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  	"github.com/go-openapi/swag"
    14  
    15  	strfmt "github.com/go-openapi/strfmt"
    16  
    17  	models "github.com/aeternity/aepp-sdk-go/swagguard/node/models"
    18  )
    19  
    20  // GetCurrentKeyBlockHashReader is a Reader for the GetCurrentKeyBlockHash structure.
    21  type GetCurrentKeyBlockHashReader struct {
    22  	formats strfmt.Registry
    23  }
    24  
    25  // ReadResponse reads a server response into the received o.
    26  func (o *GetCurrentKeyBlockHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    27  	switch response.Code() {
    28  
    29  	case 200:
    30  		result := NewGetCurrentKeyBlockHashOK()
    31  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    32  			return nil, err
    33  		}
    34  		return result, nil
    35  
    36  	case 404:
    37  		result := NewGetCurrentKeyBlockHashNotFound()
    38  		if err := result.readResponse(response, consumer, o.formats); err != nil {
    39  			return nil, err
    40  		}
    41  		return nil, result
    42  
    43  	default:
    44  		return nil, runtime.NewAPIError("unknown error", response, response.Code())
    45  	}
    46  }
    47  
    48  // NewGetCurrentKeyBlockHashOK creates a GetCurrentKeyBlockHashOK with default headers values
    49  func NewGetCurrentKeyBlockHashOK() *GetCurrentKeyBlockHashOK {
    50  	return &GetCurrentKeyBlockHashOK{}
    51  }
    52  
    53  /*GetCurrentKeyBlockHashOK handles this case with default header values.
    54  
    55  Successful operation
    56  */
    57  type GetCurrentKeyBlockHashOK struct {
    58  	Payload *GetCurrentKeyBlockHashOKBody
    59  }
    60  
    61  func (o *GetCurrentKeyBlockHashOK) Error() string {
    62  	return fmt.Sprintf("[GET /key-blocks/current/hash][%d] getCurrentKeyBlockHashOK  %+v", 200, o.Payload)
    63  }
    64  
    65  func (o *GetCurrentKeyBlockHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    66  
    67  	o.Payload = new(GetCurrentKeyBlockHashOKBody)
    68  
    69  	// response payload
    70  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
    71  		return err
    72  	}
    73  
    74  	return nil
    75  }
    76  
    77  // NewGetCurrentKeyBlockHashNotFound creates a GetCurrentKeyBlockHashNotFound with default headers values
    78  func NewGetCurrentKeyBlockHashNotFound() *GetCurrentKeyBlockHashNotFound {
    79  	return &GetCurrentKeyBlockHashNotFound{}
    80  }
    81  
    82  /*GetCurrentKeyBlockHashNotFound handles this case with default header values.
    83  
    84  Block not found
    85  */
    86  type GetCurrentKeyBlockHashNotFound struct {
    87  	Payload *models.Error
    88  }
    89  
    90  func (o *GetCurrentKeyBlockHashNotFound) Error() string {
    91  	return fmt.Sprintf("[GET /key-blocks/current/hash][%d] getCurrentKeyBlockHashNotFound  %+v", 404, o.Payload)
    92  }
    93  
    94  func (o *GetCurrentKeyBlockHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    95  
    96  	o.Payload = new(models.Error)
    97  
    98  	// response payload
    99  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   100  		return err
   101  	}
   102  
   103  	return nil
   104  }
   105  
   106  /*GetCurrentKeyBlockHashOKBody get current key block hash o k body
   107  swagger:model GetCurrentKeyBlockHashOKBody
   108  */
   109  type GetCurrentKeyBlockHashOKBody struct {
   110  
   111  	// hash
   112  	Hash string `json:"hash,omitempty"`
   113  }
   114  
   115  // Validate validates this get current key block hash o k body
   116  func (o *GetCurrentKeyBlockHashOKBody) Validate(formats strfmt.Registry) error {
   117  	return nil
   118  }
   119  
   120  // MarshalBinary interface implementation
   121  func (o *GetCurrentKeyBlockHashOKBody) MarshalBinary() ([]byte, error) {
   122  	if o == nil {
   123  		return nil, nil
   124  	}
   125  	return swag.WriteJSON(o)
   126  }
   127  
   128  // UnmarshalBinary interface implementation
   129  func (o *GetCurrentKeyBlockHashOKBody) UnmarshalBinary(b []byte) error {
   130  	var res GetCurrentKeyBlockHashOKBody
   131  	if err := swag.ReadJSON(b, &res); err != nil {
   132  		return err
   133  	}
   134  	*o = res
   135  	return nil
   136  }