github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_client/users/unique_username_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package users
     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/strfmt"
    17  )
    18  
    19  // NewUniqueUsernameParams creates a new UniqueUsernameParams object,
    20  // with the default timeout for this client.
    21  //
    22  // Default values are not hydrated, since defaults are normally applied by the API server side.
    23  //
    24  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    25  func NewUniqueUsernameParams() *UniqueUsernameParams {
    26  	return &UniqueUsernameParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewUniqueUsernameParamsWithTimeout creates a new UniqueUsernameParams object
    32  // with the ability to set a timeout on a request.
    33  func NewUniqueUsernameParamsWithTimeout(timeout time.Duration) *UniqueUsernameParams {
    34  	return &UniqueUsernameParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewUniqueUsernameParamsWithContext creates a new UniqueUsernameParams object
    40  // with the ability to set a context for a request.
    41  func NewUniqueUsernameParamsWithContext(ctx context.Context) *UniqueUsernameParams {
    42  	return &UniqueUsernameParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewUniqueUsernameParamsWithHTTPClient creates a new UniqueUsernameParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewUniqueUsernameParamsWithHTTPClient(client *http.Client) *UniqueUsernameParams {
    50  	return &UniqueUsernameParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /* UniqueUsernameParams contains all the parameters to send to the API endpoint
    56     for the unique username operation.
    57  
    58     Typically these are written to a http.Request.
    59  */
    60  type UniqueUsernameParams struct {
    61  
    62  	/* Username.
    63  
    64  	   desired Username
    65  	*/
    66  	Username string
    67  
    68  	timeout    time.Duration
    69  	Context    context.Context
    70  	HTTPClient *http.Client
    71  }
    72  
    73  // WithDefaults hydrates default values in the unique username params (not the query body).
    74  //
    75  // All values with no default are reset to their zero value.
    76  func (o *UniqueUsernameParams) WithDefaults() *UniqueUsernameParams {
    77  	o.SetDefaults()
    78  	return o
    79  }
    80  
    81  // SetDefaults hydrates default values in the unique username params (not the query body).
    82  //
    83  // All values with no default are reset to their zero value.
    84  func (o *UniqueUsernameParams) SetDefaults() {
    85  	// no default values defined for this parameter
    86  }
    87  
    88  // WithTimeout adds the timeout to the unique username params
    89  func (o *UniqueUsernameParams) WithTimeout(timeout time.Duration) *UniqueUsernameParams {
    90  	o.SetTimeout(timeout)
    91  	return o
    92  }
    93  
    94  // SetTimeout adds the timeout to the unique username params
    95  func (o *UniqueUsernameParams) SetTimeout(timeout time.Duration) {
    96  	o.timeout = timeout
    97  }
    98  
    99  // WithContext adds the context to the unique username params
   100  func (o *UniqueUsernameParams) WithContext(ctx context.Context) *UniqueUsernameParams {
   101  	o.SetContext(ctx)
   102  	return o
   103  }
   104  
   105  // SetContext adds the context to the unique username params
   106  func (o *UniqueUsernameParams) SetContext(ctx context.Context) {
   107  	o.Context = ctx
   108  }
   109  
   110  // WithHTTPClient adds the HTTPClient to the unique username params
   111  func (o *UniqueUsernameParams) WithHTTPClient(client *http.Client) *UniqueUsernameParams {
   112  	o.SetHTTPClient(client)
   113  	return o
   114  }
   115  
   116  // SetHTTPClient adds the HTTPClient to the unique username params
   117  func (o *UniqueUsernameParams) SetHTTPClient(client *http.Client) {
   118  	o.HTTPClient = client
   119  }
   120  
   121  // WithUsername adds the username to the unique username params
   122  func (o *UniqueUsernameParams) WithUsername(username string) *UniqueUsernameParams {
   123  	o.SetUsername(username)
   124  	return o
   125  }
   126  
   127  // SetUsername adds the username to the unique username params
   128  func (o *UniqueUsernameParams) SetUsername(username string) {
   129  	o.Username = username
   130  }
   131  
   132  // WriteToRequest writes these params to a swagger request
   133  func (o *UniqueUsernameParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   134  
   135  	if err := r.SetTimeout(o.timeout); err != nil {
   136  		return err
   137  	}
   138  	var res []error
   139  
   140  	// path param username
   141  	if err := r.SetPathParam("username", o.Username); err != nil {
   142  		return err
   143  	}
   144  
   145  	if len(res) > 0 {
   146  		return errors.CompositeValidationError(res...)
   147  	}
   148  	return nil
   149  }