github.com/digitalocean/go-netbox@v0.0.2/netbox/client/extras/extras_custom_fields_list_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  // Copyright 2020 The go-netbox Authors.
     4  //
     5  // Licensed under the Apache License, Version 2.0 (the "License");
     6  // you may not use this file except in compliance with the License.
     7  // You may obtain a copy of the License at
     8  //
     9  //   http://www.apache.org/licenses/LICENSE-2.0
    10  //
    11  // Unless required by applicable law or agreed to in writing, software
    12  // distributed under the License is distributed on an "AS IS" BASIS,
    13  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14  // See the License for the specific language governing permissions and
    15  // limitations under the License.
    16  //
    17  
    18  package extras
    19  
    20  // This file was generated by the swagger tool.
    21  // Editing this file might prove futile when you re-run the swagger generate command
    22  
    23  import (
    24  	"context"
    25  	"net/http"
    26  	"time"
    27  
    28  	"github.com/go-openapi/errors"
    29  	"github.com/go-openapi/runtime"
    30  	cr "github.com/go-openapi/runtime/client"
    31  	"github.com/go-openapi/strfmt"
    32  	"github.com/go-openapi/swag"
    33  )
    34  
    35  // NewExtrasCustomFieldsListParams creates a new ExtrasCustomFieldsListParams object,
    36  // with the default timeout for this client.
    37  //
    38  // Default values are not hydrated, since defaults are normally applied by the API server side.
    39  //
    40  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    41  func NewExtrasCustomFieldsListParams() *ExtrasCustomFieldsListParams {
    42  	return &ExtrasCustomFieldsListParams{
    43  		timeout: cr.DefaultTimeout,
    44  	}
    45  }
    46  
    47  // NewExtrasCustomFieldsListParamsWithTimeout creates a new ExtrasCustomFieldsListParams object
    48  // with the ability to set a timeout on a request.
    49  func NewExtrasCustomFieldsListParamsWithTimeout(timeout time.Duration) *ExtrasCustomFieldsListParams {
    50  	return &ExtrasCustomFieldsListParams{
    51  		timeout: timeout,
    52  	}
    53  }
    54  
    55  // NewExtrasCustomFieldsListParamsWithContext creates a new ExtrasCustomFieldsListParams object
    56  // with the ability to set a context for a request.
    57  func NewExtrasCustomFieldsListParamsWithContext(ctx context.Context) *ExtrasCustomFieldsListParams {
    58  	return &ExtrasCustomFieldsListParams{
    59  		Context: ctx,
    60  	}
    61  }
    62  
    63  // NewExtrasCustomFieldsListParamsWithHTTPClient creates a new ExtrasCustomFieldsListParams object
    64  // with the ability to set a custom HTTPClient for a request.
    65  func NewExtrasCustomFieldsListParamsWithHTTPClient(client *http.Client) *ExtrasCustomFieldsListParams {
    66  	return &ExtrasCustomFieldsListParams{
    67  		HTTPClient: client,
    68  	}
    69  }
    70  
    71  /* ExtrasCustomFieldsListParams contains all the parameters to send to the API endpoint
    72     for the extras custom fields list operation.
    73  
    74     Typically these are written to a http.Request.
    75  */
    76  type ExtrasCustomFieldsListParams struct {
    77  
    78  	// ContentTypes.
    79  	ContentTypes *string
    80  
    81  	// FilterLogic.
    82  	FilterLogic *string
    83  
    84  	// ID.
    85  	ID *float64
    86  
    87  	/* Limit.
    88  
    89  	   Number of results to return per page.
    90  	*/
    91  	Limit *int64
    92  
    93  	// Name.
    94  	Name *string
    95  
    96  	/* Offset.
    97  
    98  	   The initial index from which to return the results.
    99  	*/
   100  	Offset *int64
   101  
   102  	// Required.
   103  	Required *string
   104  
   105  	// Weight.
   106  	Weight *float64
   107  
   108  	timeout    time.Duration
   109  	Context    context.Context
   110  	HTTPClient *http.Client
   111  }
   112  
   113  // WithDefaults hydrates default values in the extras custom fields list params (not the query body).
   114  //
   115  // All values with no default are reset to their zero value.
   116  func (o *ExtrasCustomFieldsListParams) WithDefaults() *ExtrasCustomFieldsListParams {
   117  	o.SetDefaults()
   118  	return o
   119  }
   120  
   121  // SetDefaults hydrates default values in the extras custom fields list params (not the query body).
   122  //
   123  // All values with no default are reset to their zero value.
   124  func (o *ExtrasCustomFieldsListParams) SetDefaults() {
   125  	// no default values defined for this parameter
   126  }
   127  
   128  // WithTimeout adds the timeout to the extras custom fields list params
   129  func (o *ExtrasCustomFieldsListParams) WithTimeout(timeout time.Duration) *ExtrasCustomFieldsListParams {
   130  	o.SetTimeout(timeout)
   131  	return o
   132  }
   133  
   134  // SetTimeout adds the timeout to the extras custom fields list params
   135  func (o *ExtrasCustomFieldsListParams) SetTimeout(timeout time.Duration) {
   136  	o.timeout = timeout
   137  }
   138  
   139  // WithContext adds the context to the extras custom fields list params
   140  func (o *ExtrasCustomFieldsListParams) WithContext(ctx context.Context) *ExtrasCustomFieldsListParams {
   141  	o.SetContext(ctx)
   142  	return o
   143  }
   144  
   145  // SetContext adds the context to the extras custom fields list params
   146  func (o *ExtrasCustomFieldsListParams) SetContext(ctx context.Context) {
   147  	o.Context = ctx
   148  }
   149  
   150  // WithHTTPClient adds the HTTPClient to the extras custom fields list params
   151  func (o *ExtrasCustomFieldsListParams) WithHTTPClient(client *http.Client) *ExtrasCustomFieldsListParams {
   152  	o.SetHTTPClient(client)
   153  	return o
   154  }
   155  
   156  // SetHTTPClient adds the HTTPClient to the extras custom fields list params
   157  func (o *ExtrasCustomFieldsListParams) SetHTTPClient(client *http.Client) {
   158  	o.HTTPClient = client
   159  }
   160  
   161  // WithContentTypes adds the contentTypes to the extras custom fields list params
   162  func (o *ExtrasCustomFieldsListParams) WithContentTypes(contentTypes *string) *ExtrasCustomFieldsListParams {
   163  	o.SetContentTypes(contentTypes)
   164  	return o
   165  }
   166  
   167  // SetContentTypes adds the contentTypes to the extras custom fields list params
   168  func (o *ExtrasCustomFieldsListParams) SetContentTypes(contentTypes *string) {
   169  	o.ContentTypes = contentTypes
   170  }
   171  
   172  // WithFilterLogic adds the filterLogic to the extras custom fields list params
   173  func (o *ExtrasCustomFieldsListParams) WithFilterLogic(filterLogic *string) *ExtrasCustomFieldsListParams {
   174  	o.SetFilterLogic(filterLogic)
   175  	return o
   176  }
   177  
   178  // SetFilterLogic adds the filterLogic to the extras custom fields list params
   179  func (o *ExtrasCustomFieldsListParams) SetFilterLogic(filterLogic *string) {
   180  	o.FilterLogic = filterLogic
   181  }
   182  
   183  // WithID adds the id to the extras custom fields list params
   184  func (o *ExtrasCustomFieldsListParams) WithID(id *float64) *ExtrasCustomFieldsListParams {
   185  	o.SetID(id)
   186  	return o
   187  }
   188  
   189  // SetID adds the id to the extras custom fields list params
   190  func (o *ExtrasCustomFieldsListParams) SetID(id *float64) {
   191  	o.ID = id
   192  }
   193  
   194  // WithLimit adds the limit to the extras custom fields list params
   195  func (o *ExtrasCustomFieldsListParams) WithLimit(limit *int64) *ExtrasCustomFieldsListParams {
   196  	o.SetLimit(limit)
   197  	return o
   198  }
   199  
   200  // SetLimit adds the limit to the extras custom fields list params
   201  func (o *ExtrasCustomFieldsListParams) SetLimit(limit *int64) {
   202  	o.Limit = limit
   203  }
   204  
   205  // WithName adds the name to the extras custom fields list params
   206  func (o *ExtrasCustomFieldsListParams) WithName(name *string) *ExtrasCustomFieldsListParams {
   207  	o.SetName(name)
   208  	return o
   209  }
   210  
   211  // SetName adds the name to the extras custom fields list params
   212  func (o *ExtrasCustomFieldsListParams) SetName(name *string) {
   213  	o.Name = name
   214  }
   215  
   216  // WithOffset adds the offset to the extras custom fields list params
   217  func (o *ExtrasCustomFieldsListParams) WithOffset(offset *int64) *ExtrasCustomFieldsListParams {
   218  	o.SetOffset(offset)
   219  	return o
   220  }
   221  
   222  // SetOffset adds the offset to the extras custom fields list params
   223  func (o *ExtrasCustomFieldsListParams) SetOffset(offset *int64) {
   224  	o.Offset = offset
   225  }
   226  
   227  // WithRequired adds the required to the extras custom fields list params
   228  func (o *ExtrasCustomFieldsListParams) WithRequired(required *string) *ExtrasCustomFieldsListParams {
   229  	o.SetRequired(required)
   230  	return o
   231  }
   232  
   233  // SetRequired adds the required to the extras custom fields list params
   234  func (o *ExtrasCustomFieldsListParams) SetRequired(required *string) {
   235  	o.Required = required
   236  }
   237  
   238  // WithWeight adds the weight to the extras custom fields list params
   239  func (o *ExtrasCustomFieldsListParams) WithWeight(weight *float64) *ExtrasCustomFieldsListParams {
   240  	o.SetWeight(weight)
   241  	return o
   242  }
   243  
   244  // SetWeight adds the weight to the extras custom fields list params
   245  func (o *ExtrasCustomFieldsListParams) SetWeight(weight *float64) {
   246  	o.Weight = weight
   247  }
   248  
   249  // WriteToRequest writes these params to a swagger request
   250  func (o *ExtrasCustomFieldsListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   251  
   252  	if err := r.SetTimeout(o.timeout); err != nil {
   253  		return err
   254  	}
   255  	var res []error
   256  
   257  	if o.ContentTypes != nil {
   258  
   259  		// query param content_types
   260  		var qrContentTypes string
   261  
   262  		if o.ContentTypes != nil {
   263  			qrContentTypes = *o.ContentTypes
   264  		}
   265  		qContentTypes := qrContentTypes
   266  		if qContentTypes != "" {
   267  
   268  			if err := r.SetQueryParam("content_types", qContentTypes); err != nil {
   269  				return err
   270  			}
   271  		}
   272  	}
   273  
   274  	if o.FilterLogic != nil {
   275  
   276  		// query param filter_logic
   277  		var qrFilterLogic string
   278  
   279  		if o.FilterLogic != nil {
   280  			qrFilterLogic = *o.FilterLogic
   281  		}
   282  		qFilterLogic := qrFilterLogic
   283  		if qFilterLogic != "" {
   284  
   285  			if err := r.SetQueryParam("filter_logic", qFilterLogic); err != nil {
   286  				return err
   287  			}
   288  		}
   289  	}
   290  
   291  	if o.ID != nil {
   292  
   293  		// query param id
   294  		var qrID float64
   295  
   296  		if o.ID != nil {
   297  			qrID = *o.ID
   298  		}
   299  		qID := swag.FormatFloat64(qrID)
   300  		if qID != "" {
   301  
   302  			if err := r.SetQueryParam("id", qID); err != nil {
   303  				return err
   304  			}
   305  		}
   306  	}
   307  
   308  	if o.Limit != nil {
   309  
   310  		// query param limit
   311  		var qrLimit int64
   312  
   313  		if o.Limit != nil {
   314  			qrLimit = *o.Limit
   315  		}
   316  		qLimit := swag.FormatInt64(qrLimit)
   317  		if qLimit != "" {
   318  
   319  			if err := r.SetQueryParam("limit", qLimit); err != nil {
   320  				return err
   321  			}
   322  		}
   323  	}
   324  
   325  	if o.Name != nil {
   326  
   327  		// query param name
   328  		var qrName string
   329  
   330  		if o.Name != nil {
   331  			qrName = *o.Name
   332  		}
   333  		qName := qrName
   334  		if qName != "" {
   335  
   336  			if err := r.SetQueryParam("name", qName); err != nil {
   337  				return err
   338  			}
   339  		}
   340  	}
   341  
   342  	if o.Offset != nil {
   343  
   344  		// query param offset
   345  		var qrOffset int64
   346  
   347  		if o.Offset != nil {
   348  			qrOffset = *o.Offset
   349  		}
   350  		qOffset := swag.FormatInt64(qrOffset)
   351  		if qOffset != "" {
   352  
   353  			if err := r.SetQueryParam("offset", qOffset); err != nil {
   354  				return err
   355  			}
   356  		}
   357  	}
   358  
   359  	if o.Required != nil {
   360  
   361  		// query param required
   362  		var qrRequired string
   363  
   364  		if o.Required != nil {
   365  			qrRequired = *o.Required
   366  		}
   367  		qRequired := qrRequired
   368  		if qRequired != "" {
   369  
   370  			if err := r.SetQueryParam("required", qRequired); err != nil {
   371  				return err
   372  			}
   373  		}
   374  	}
   375  
   376  	if o.Weight != nil {
   377  
   378  		// query param weight
   379  		var qrWeight float64
   380  
   381  		if o.Weight != nil {
   382  			qrWeight = *o.Weight
   383  		}
   384  		qWeight := swag.FormatFloat64(qrWeight)
   385  		if qWeight != "" {
   386  
   387  			if err := r.SetQueryParam("weight", qWeight); err != nil {
   388  				return err
   389  			}
   390  		}
   391  	}
   392  
   393  	if len(res) > 0 {
   394  		return errors.CompositeValidationError(res...)
   395  	}
   396  	return nil
   397  }