github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/client/external/get_key_block_by_height_parameters.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  	"context"
    10  	"net/http"
    11  	"time"
    12  
    13  	"github.com/go-openapi/errors"
    14  	"github.com/go-openapi/runtime"
    15  	cr "github.com/go-openapi/runtime/client"
    16  	"github.com/go-openapi/swag"
    17  
    18  	strfmt "github.com/go-openapi/strfmt"
    19  )
    20  
    21  // NewGetKeyBlockByHeightParams creates a new GetKeyBlockByHeightParams object
    22  // with the default values initialized.
    23  func NewGetKeyBlockByHeightParams() *GetKeyBlockByHeightParams {
    24  	var ()
    25  	return &GetKeyBlockByHeightParams{
    26  
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewGetKeyBlockByHeightParamsWithTimeout creates a new GetKeyBlockByHeightParams object
    32  // with the default values initialized, and the ability to set a timeout on a request
    33  func NewGetKeyBlockByHeightParamsWithTimeout(timeout time.Duration) *GetKeyBlockByHeightParams {
    34  	var ()
    35  	return &GetKeyBlockByHeightParams{
    36  
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewGetKeyBlockByHeightParamsWithContext creates a new GetKeyBlockByHeightParams object
    42  // with the default values initialized, and the ability to set a context for a request
    43  func NewGetKeyBlockByHeightParamsWithContext(ctx context.Context) *GetKeyBlockByHeightParams {
    44  	var ()
    45  	return &GetKeyBlockByHeightParams{
    46  
    47  		Context: ctx,
    48  	}
    49  }
    50  
    51  // NewGetKeyBlockByHeightParamsWithHTTPClient creates a new GetKeyBlockByHeightParams object
    52  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    53  func NewGetKeyBlockByHeightParamsWithHTTPClient(client *http.Client) *GetKeyBlockByHeightParams {
    54  	var ()
    55  	return &GetKeyBlockByHeightParams{
    56  		HTTPClient: client,
    57  	}
    58  }
    59  
    60  /*GetKeyBlockByHeightParams contains all the parameters to send to the API endpoint
    61  for the get key block by height operation typically these are written to a http.Request
    62  */
    63  type GetKeyBlockByHeightParams struct {
    64  
    65  	/*Height
    66  	  The height
    67  
    68  	*/
    69  	Height uint64
    70  
    71  	timeout    time.Duration
    72  	Context    context.Context
    73  	HTTPClient *http.Client
    74  }
    75  
    76  // WithTimeout adds the timeout to the get key block by height params
    77  func (o *GetKeyBlockByHeightParams) WithTimeout(timeout time.Duration) *GetKeyBlockByHeightParams {
    78  	o.SetTimeout(timeout)
    79  	return o
    80  }
    81  
    82  // SetTimeout adds the timeout to the get key block by height params
    83  func (o *GetKeyBlockByHeightParams) SetTimeout(timeout time.Duration) {
    84  	o.timeout = timeout
    85  }
    86  
    87  // WithContext adds the context to the get key block by height params
    88  func (o *GetKeyBlockByHeightParams) WithContext(ctx context.Context) *GetKeyBlockByHeightParams {
    89  	o.SetContext(ctx)
    90  	return o
    91  }
    92  
    93  // SetContext adds the context to the get key block by height params
    94  func (o *GetKeyBlockByHeightParams) SetContext(ctx context.Context) {
    95  	o.Context = ctx
    96  }
    97  
    98  // WithHTTPClient adds the HTTPClient to the get key block by height params
    99  func (o *GetKeyBlockByHeightParams) WithHTTPClient(client *http.Client) *GetKeyBlockByHeightParams {
   100  	o.SetHTTPClient(client)
   101  	return o
   102  }
   103  
   104  // SetHTTPClient adds the HTTPClient to the get key block by height params
   105  func (o *GetKeyBlockByHeightParams) SetHTTPClient(client *http.Client) {
   106  	o.HTTPClient = client
   107  }
   108  
   109  // WithHeight adds the height to the get key block by height params
   110  func (o *GetKeyBlockByHeightParams) WithHeight(height uint64) *GetKeyBlockByHeightParams {
   111  	o.SetHeight(height)
   112  	return o
   113  }
   114  
   115  // SetHeight adds the height to the get key block by height params
   116  func (o *GetKeyBlockByHeightParams) SetHeight(height uint64) {
   117  	o.Height = height
   118  }
   119  
   120  // WriteToRequest writes these params to a swagger request
   121  func (o *GetKeyBlockByHeightParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   122  
   123  	if err := r.SetTimeout(o.timeout); err != nil {
   124  		return err
   125  	}
   126  	var res []error
   127  
   128  	// path param height
   129  	if err := r.SetPathParam("height", swag.FormatUint64(o.Height)); err != nil {
   130  		return err
   131  	}
   132  
   133  	if len(res) > 0 {
   134  		return errors.CompositeValidationError(res...)
   135  	}
   136  	return nil
   137  }