github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/client/external/get_account_by_pubkey_and_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  
    14  	strfmt "github.com/go-openapi/strfmt"
    15  
    16  	models "github.com/aeternity/aepp-sdk-go/generated/models"
    17  )
    18  
    19  // GetAccountByPubkeyAndHashReader is a Reader for the GetAccountByPubkeyAndHash structure.
    20  type GetAccountByPubkeyAndHashReader struct {
    21  	formats strfmt.Registry
    22  }
    23  
    24  // ReadResponse reads a server response into the received o.
    25  func (o *GetAccountByPubkeyAndHashReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
    26  	switch response.Code() {
    27  
    28  	case 200:
    29  		result := NewGetAccountByPubkeyAndHashOK()
    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 := NewGetAccountByPubkeyAndHashBadRequest()
    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 := NewGetAccountByPubkeyAndHashNotFound()
    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  // NewGetAccountByPubkeyAndHashOK creates a GetAccountByPubkeyAndHashOK with default headers values
    55  func NewGetAccountByPubkeyAndHashOK() *GetAccountByPubkeyAndHashOK {
    56  	return &GetAccountByPubkeyAndHashOK{}
    57  }
    58  
    59  /*GetAccountByPubkeyAndHashOK handles this case with default header values.
    60  
    61  Successful operation
    62  */
    63  type GetAccountByPubkeyAndHashOK struct {
    64  	Payload *models.Account
    65  }
    66  
    67  func (o *GetAccountByPubkeyAndHashOK) Error() string {
    68  	return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashOK  %+v", 200, o.Payload)
    69  }
    70  
    71  func (o *GetAccountByPubkeyAndHashOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
    72  
    73  	o.Payload = new(models.Account)
    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  // NewGetAccountByPubkeyAndHashBadRequest creates a GetAccountByPubkeyAndHashBadRequest with default headers values
    84  func NewGetAccountByPubkeyAndHashBadRequest() *GetAccountByPubkeyAndHashBadRequest {
    85  	return &GetAccountByPubkeyAndHashBadRequest{}
    86  }
    87  
    88  /*GetAccountByPubkeyAndHashBadRequest handles this case with default header values.
    89  
    90  Invalid public key or invalid hash
    91  */
    92  type GetAccountByPubkeyAndHashBadRequest struct {
    93  	Payload *models.Error
    94  }
    95  
    96  func (o *GetAccountByPubkeyAndHashBadRequest) Error() string {
    97  	return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashBadRequest  %+v", 400, o.Payload)
    98  }
    99  
   100  func (o *GetAccountByPubkeyAndHashBadRequest) 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  // NewGetAccountByPubkeyAndHashNotFound creates a GetAccountByPubkeyAndHashNotFound with default headers values
   113  func NewGetAccountByPubkeyAndHashNotFound() *GetAccountByPubkeyAndHashNotFound {
   114  	return &GetAccountByPubkeyAndHashNotFound{}
   115  }
   116  
   117  /*GetAccountByPubkeyAndHashNotFound handles this case with default header values.
   118  
   119  Account not found or hash not available
   120  */
   121  type GetAccountByPubkeyAndHashNotFound struct {
   122  	Payload *models.Error
   123  }
   124  
   125  func (o *GetAccountByPubkeyAndHashNotFound) Error() string {
   126  	return fmt.Sprintf("[GET /accounts/{pubkey}/hash/{hash}][%d] getAccountByPubkeyAndHashNotFound  %+v", 404, o.Payload)
   127  }
   128  
   129  func (o *GetAccountByPubkeyAndHashNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {
   130  
   131  	o.Payload = new(models.Error)
   132  
   133  	// response payload
   134  	if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF {
   135  		return err
   136  	}
   137  
   138  	return nil
   139  }