github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/client/external/get_oracle_queries_by_pubkey_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  // NewGetOracleQueriesByPubkeyParams creates a new GetOracleQueriesByPubkeyParams object
    22  // with the default values initialized.
    23  func NewGetOracleQueriesByPubkeyParams() *GetOracleQueriesByPubkeyParams {
    24  	var ()
    25  	return &GetOracleQueriesByPubkeyParams{
    26  
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewGetOracleQueriesByPubkeyParamsWithTimeout creates a new GetOracleQueriesByPubkeyParams object
    32  // with the default values initialized, and the ability to set a timeout on a request
    33  func NewGetOracleQueriesByPubkeyParamsWithTimeout(timeout time.Duration) *GetOracleQueriesByPubkeyParams {
    34  	var ()
    35  	return &GetOracleQueriesByPubkeyParams{
    36  
    37  		timeout: timeout,
    38  	}
    39  }
    40  
    41  // NewGetOracleQueriesByPubkeyParamsWithContext creates a new GetOracleQueriesByPubkeyParams object
    42  // with the default values initialized, and the ability to set a context for a request
    43  func NewGetOracleQueriesByPubkeyParamsWithContext(ctx context.Context) *GetOracleQueriesByPubkeyParams {
    44  	var ()
    45  	return &GetOracleQueriesByPubkeyParams{
    46  
    47  		Context: ctx,
    48  	}
    49  }
    50  
    51  // NewGetOracleQueriesByPubkeyParamsWithHTTPClient creates a new GetOracleQueriesByPubkeyParams object
    52  // with the default values initialized, and the ability to set a custom HTTPClient for a request
    53  func NewGetOracleQueriesByPubkeyParamsWithHTTPClient(client *http.Client) *GetOracleQueriesByPubkeyParams {
    54  	var ()
    55  	return &GetOracleQueriesByPubkeyParams{
    56  		HTTPClient: client,
    57  	}
    58  }
    59  
    60  /*GetOracleQueriesByPubkeyParams contains all the parameters to send to the API endpoint
    61  for the get oracle queries by pubkey operation typically these are written to a http.Request
    62  */
    63  type GetOracleQueriesByPubkeyParams struct {
    64  
    65  	/*From
    66  	  Last query id in previous page
    67  
    68  	*/
    69  	From *string
    70  	/*Limit
    71  	  Max number of oracle queries
    72  
    73  	*/
    74  	Limit *int64
    75  	/*Pubkey
    76  	  The public key of the oracle
    77  
    78  	*/
    79  	Pubkey string
    80  	/*Type
    81  	  The type of a query: open, closed or all
    82  
    83  	*/
    84  	Type *string
    85  
    86  	timeout    time.Duration
    87  	Context    context.Context
    88  	HTTPClient *http.Client
    89  }
    90  
    91  // WithTimeout adds the timeout to the get oracle queries by pubkey params
    92  func (o *GetOracleQueriesByPubkeyParams) WithTimeout(timeout time.Duration) *GetOracleQueriesByPubkeyParams {
    93  	o.SetTimeout(timeout)
    94  	return o
    95  }
    96  
    97  // SetTimeout adds the timeout to the get oracle queries by pubkey params
    98  func (o *GetOracleQueriesByPubkeyParams) SetTimeout(timeout time.Duration) {
    99  	o.timeout = timeout
   100  }
   101  
   102  // WithContext adds the context to the get oracle queries by pubkey params
   103  func (o *GetOracleQueriesByPubkeyParams) WithContext(ctx context.Context) *GetOracleQueriesByPubkeyParams {
   104  	o.SetContext(ctx)
   105  	return o
   106  }
   107  
   108  // SetContext adds the context to the get oracle queries by pubkey params
   109  func (o *GetOracleQueriesByPubkeyParams) SetContext(ctx context.Context) {
   110  	o.Context = ctx
   111  }
   112  
   113  // WithHTTPClient adds the HTTPClient to the get oracle queries by pubkey params
   114  func (o *GetOracleQueriesByPubkeyParams) WithHTTPClient(client *http.Client) *GetOracleQueriesByPubkeyParams {
   115  	o.SetHTTPClient(client)
   116  	return o
   117  }
   118  
   119  // SetHTTPClient adds the HTTPClient to the get oracle queries by pubkey params
   120  func (o *GetOracleQueriesByPubkeyParams) SetHTTPClient(client *http.Client) {
   121  	o.HTTPClient = client
   122  }
   123  
   124  // WithFrom adds the from to the get oracle queries by pubkey params
   125  func (o *GetOracleQueriesByPubkeyParams) WithFrom(from *string) *GetOracleQueriesByPubkeyParams {
   126  	o.SetFrom(from)
   127  	return o
   128  }
   129  
   130  // SetFrom adds the from to the get oracle queries by pubkey params
   131  func (o *GetOracleQueriesByPubkeyParams) SetFrom(from *string) {
   132  	o.From = from
   133  }
   134  
   135  // WithLimit adds the limit to the get oracle queries by pubkey params
   136  func (o *GetOracleQueriesByPubkeyParams) WithLimit(limit *int64) *GetOracleQueriesByPubkeyParams {
   137  	o.SetLimit(limit)
   138  	return o
   139  }
   140  
   141  // SetLimit adds the limit to the get oracle queries by pubkey params
   142  func (o *GetOracleQueriesByPubkeyParams) SetLimit(limit *int64) {
   143  	o.Limit = limit
   144  }
   145  
   146  // WithPubkey adds the pubkey to the get oracle queries by pubkey params
   147  func (o *GetOracleQueriesByPubkeyParams) WithPubkey(pubkey string) *GetOracleQueriesByPubkeyParams {
   148  	o.SetPubkey(pubkey)
   149  	return o
   150  }
   151  
   152  // SetPubkey adds the pubkey to the get oracle queries by pubkey params
   153  func (o *GetOracleQueriesByPubkeyParams) SetPubkey(pubkey string) {
   154  	o.Pubkey = pubkey
   155  }
   156  
   157  // WithType adds the typeVar to the get oracle queries by pubkey params
   158  func (o *GetOracleQueriesByPubkeyParams) WithType(typeVar *string) *GetOracleQueriesByPubkeyParams {
   159  	o.SetType(typeVar)
   160  	return o
   161  }
   162  
   163  // SetType adds the type to the get oracle queries by pubkey params
   164  func (o *GetOracleQueriesByPubkeyParams) SetType(typeVar *string) {
   165  	o.Type = typeVar
   166  }
   167  
   168  // WriteToRequest writes these params to a swagger request
   169  func (o *GetOracleQueriesByPubkeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   170  
   171  	if err := r.SetTimeout(o.timeout); err != nil {
   172  		return err
   173  	}
   174  	var res []error
   175  
   176  	if o.From != nil {
   177  
   178  		// query param from
   179  		var qrFrom string
   180  		if o.From != nil {
   181  			qrFrom = *o.From
   182  		}
   183  		qFrom := qrFrom
   184  		if qFrom != "" {
   185  			if err := r.SetQueryParam("from", qFrom); err != nil {
   186  				return err
   187  			}
   188  		}
   189  
   190  	}
   191  
   192  	if o.Limit != nil {
   193  
   194  		// query param limit
   195  		var qrLimit int64
   196  		if o.Limit != nil {
   197  			qrLimit = *o.Limit
   198  		}
   199  		qLimit := swag.FormatInt64(qrLimit)
   200  		if qLimit != "" {
   201  			if err := r.SetQueryParam("limit", qLimit); err != nil {
   202  				return err
   203  			}
   204  		}
   205  
   206  	}
   207  
   208  	// path param pubkey
   209  	if err := r.SetPathParam("pubkey", o.Pubkey); err != nil {
   210  		return err
   211  	}
   212  
   213  	if o.Type != nil {
   214  
   215  		// query param type
   216  		var qrType string
   217  		if o.Type != nil {
   218  			qrType = *o.Type
   219  		}
   220  		qType := qrType
   221  		if qType != "" {
   222  			if err := r.SetQueryParam("type", qType); err != nil {
   223  				return err
   224  			}
   225  		}
   226  
   227  	}
   228  
   229  	if len(res) > 0 {
   230  		return errors.CompositeValidationError(res...)
   231  	}
   232  	return nil
   233  }