github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/client/external/get_current_key_block_height_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  // GetCurrentKeyBlockHeightReader is a Reader for the GetCurrentKeyBlockHeight structure.
    21  type GetCurrentKeyBlockHeightReader struct {
    22  	formats strfmt.Registry
    23  }
    24  
    25  // ReadResponse reads a server response into the received o.
    26  func (o *GetCurrentKeyBlockHeightReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    27  	switch response.Code() {
    28  
    29  	case 200:
    30  		result := NewGetCurrentKeyBlockHeightOK()
    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 := NewGetCurrentKeyBlockHeightNotFound()
    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  // NewGetCurrentKeyBlockHeightOK creates a GetCurrentKeyBlockHeightOK with default headers values
    49  func NewGetCurrentKeyBlockHeightOK() *GetCurrentKeyBlockHeightOK {
    50  	return &GetCurrentKeyBlockHeightOK{}
    51  }
    52  
    53  /*GetCurrentKeyBlockHeightOK handles this case with default header values.
    54  
    55  Successful operation
    56  */
    57  type GetCurrentKeyBlockHeightOK struct {
    58  	Payload *GetCurrentKeyBlockHeightOKBody
    59  }
    60  
    61  func (o *GetCurrentKeyBlockHeightOK) Error() string {
    62  	return fmt.Sprintf("[GET /key-blocks/current/height][%d] getCurrentKeyBlockHeightOK  %+v", 200, o.Payload)
    63  }
    64  
    65  func (o *GetCurrentKeyBlockHeightOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    66  
    67  	o.Payload = new(GetCurrentKeyBlockHeightOKBody)
    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  // NewGetCurrentKeyBlockHeightNotFound creates a GetCurrentKeyBlockHeightNotFound with default headers values
    78  func NewGetCurrentKeyBlockHeightNotFound() *GetCurrentKeyBlockHeightNotFound {
    79  	return &GetCurrentKeyBlockHeightNotFound{}
    80  }
    81  
    82  /*GetCurrentKeyBlockHeightNotFound handles this case with default header values.
    83  
    84  Block not found
    85  */
    86  type GetCurrentKeyBlockHeightNotFound struct {
    87  	Payload *models.Error
    88  }
    89  
    90  func (o *GetCurrentKeyBlockHeightNotFound) Error() string {
    91  	return fmt.Sprintf("[GET /key-blocks/current/height][%d] getCurrentKeyBlockHeightNotFound  %+v", 404, o.Payload)
    92  }
    93  
    94  func (o *GetCurrentKeyBlockHeightNotFound) 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  /*GetCurrentKeyBlockHeightOKBody get current key block height o k body
   107  swagger:model GetCurrentKeyBlockHeightOKBody
   108  */
   109  type GetCurrentKeyBlockHeightOKBody struct {
   110  
   111  	// height
   112  	Height uint64 `json:"height,omitempty"`
   113  }
   114  
   115  // Validate validates this get current key block height o k body
   116  func (o *GetCurrentKeyBlockHeightOKBody) Validate(formats strfmt.Registry) error {
   117  	return nil
   118  }
   119  
   120  // MarshalBinary interface implementation
   121  func (o *GetCurrentKeyBlockHeightOKBody) 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 *GetCurrentKeyBlockHeightOKBody) UnmarshalBinary(b []byte) error {
   130  	var res GetCurrentKeyBlockHeightOKBody
   131  	if err := swag.ReadJSON(b, &res); err != nil {
   132  		return err
   133  	}
   134  	*o = res
   135  	return nil
   136  }