github.com/goharbor/go-client@v0.210.0/pkg/sdk/v2.0/client/user/update_user_profile_parameters.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package user
     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  	"github.com/go-openapi/swag"
    18  
    19  	"github.com/goharbor/go-client/pkg/sdk/v2.0/models"
    20  )
    21  
    22  // NewUpdateUserProfileParams creates a new UpdateUserProfileParams object,
    23  // with the default timeout for this client.
    24  //
    25  // Default values are not hydrated, since defaults are normally applied by the API server side.
    26  //
    27  // To enforce default values in parameter, use SetDefaults or WithDefaults.
    28  func NewUpdateUserProfileParams() *UpdateUserProfileParams {
    29  	return &UpdateUserProfileParams{
    30  		timeout: cr.DefaultTimeout,
    31  	}
    32  }
    33  
    34  // NewUpdateUserProfileParamsWithTimeout creates a new UpdateUserProfileParams object
    35  // with the ability to set a timeout on a request.
    36  func NewUpdateUserProfileParamsWithTimeout(timeout time.Duration) *UpdateUserProfileParams {
    37  	return &UpdateUserProfileParams{
    38  		timeout: timeout,
    39  	}
    40  }
    41  
    42  // NewUpdateUserProfileParamsWithContext creates a new UpdateUserProfileParams object
    43  // with the ability to set a context for a request.
    44  func NewUpdateUserProfileParamsWithContext(ctx context.Context) *UpdateUserProfileParams {
    45  	return &UpdateUserProfileParams{
    46  		Context: ctx,
    47  	}
    48  }
    49  
    50  // NewUpdateUserProfileParamsWithHTTPClient creates a new UpdateUserProfileParams object
    51  // with the ability to set a custom HTTPClient for a request.
    52  func NewUpdateUserProfileParamsWithHTTPClient(client *http.Client) *UpdateUserProfileParams {
    53  	return &UpdateUserProfileParams{
    54  		HTTPClient: client,
    55  	}
    56  }
    57  
    58  /*
    59  UpdateUserProfileParams contains all the parameters to send to the API endpoint
    60  
    61  	for the update user profile operation.
    62  
    63  	Typically these are written to a http.Request.
    64  */
    65  type UpdateUserProfileParams struct {
    66  
    67  	/* XRequestID.
    68  
    69  	   An unique ID for the request
    70  	*/
    71  	XRequestID *string
    72  
    73  	/* Profile.
    74  
    75  	   Only email, realname and comment can be modified.
    76  	*/
    77  	Profile *models.UserProfile
    78  
    79  	/* UserID.
    80  
    81  	   Registered user ID
    82  
    83  	   Format: int
    84  	*/
    85  	UserID int64
    86  
    87  	timeout    time.Duration
    88  	Context    context.Context
    89  	HTTPClient *http.Client
    90  }
    91  
    92  // WithDefaults hydrates default values in the update user profile params (not the query body).
    93  //
    94  // All values with no default are reset to their zero value.
    95  func (o *UpdateUserProfileParams) WithDefaults() *UpdateUserProfileParams {
    96  	o.SetDefaults()
    97  	return o
    98  }
    99  
   100  // SetDefaults hydrates default values in the update user profile params (not the query body).
   101  //
   102  // All values with no default are reset to their zero value.
   103  func (o *UpdateUserProfileParams) SetDefaults() {
   104  	// no default values defined for this parameter
   105  }
   106  
   107  // WithTimeout adds the timeout to the update user profile params
   108  func (o *UpdateUserProfileParams) WithTimeout(timeout time.Duration) *UpdateUserProfileParams {
   109  	o.SetTimeout(timeout)
   110  	return o
   111  }
   112  
   113  // SetTimeout adds the timeout to the update user profile params
   114  func (o *UpdateUserProfileParams) SetTimeout(timeout time.Duration) {
   115  	o.timeout = timeout
   116  }
   117  
   118  // WithContext adds the context to the update user profile params
   119  func (o *UpdateUserProfileParams) WithContext(ctx context.Context) *UpdateUserProfileParams {
   120  	o.SetContext(ctx)
   121  	return o
   122  }
   123  
   124  // SetContext adds the context to the update user profile params
   125  func (o *UpdateUserProfileParams) SetContext(ctx context.Context) {
   126  	o.Context = ctx
   127  }
   128  
   129  // WithHTTPClient adds the HTTPClient to the update user profile params
   130  func (o *UpdateUserProfileParams) WithHTTPClient(client *http.Client) *UpdateUserProfileParams {
   131  	o.SetHTTPClient(client)
   132  	return o
   133  }
   134  
   135  // SetHTTPClient adds the HTTPClient to the update user profile params
   136  func (o *UpdateUserProfileParams) SetHTTPClient(client *http.Client) {
   137  	o.HTTPClient = client
   138  }
   139  
   140  // WithXRequestID adds the xRequestID to the update user profile params
   141  func (o *UpdateUserProfileParams) WithXRequestID(xRequestID *string) *UpdateUserProfileParams {
   142  	o.SetXRequestID(xRequestID)
   143  	return o
   144  }
   145  
   146  // SetXRequestID adds the xRequestId to the update user profile params
   147  func (o *UpdateUserProfileParams) SetXRequestID(xRequestID *string) {
   148  	o.XRequestID = xRequestID
   149  }
   150  
   151  // WithProfile adds the profile to the update user profile params
   152  func (o *UpdateUserProfileParams) WithProfile(profile *models.UserProfile) *UpdateUserProfileParams {
   153  	o.SetProfile(profile)
   154  	return o
   155  }
   156  
   157  // SetProfile adds the profile to the update user profile params
   158  func (o *UpdateUserProfileParams) SetProfile(profile *models.UserProfile) {
   159  	o.Profile = profile
   160  }
   161  
   162  // WithUserID adds the userID to the update user profile params
   163  func (o *UpdateUserProfileParams) WithUserID(userID int64) *UpdateUserProfileParams {
   164  	o.SetUserID(userID)
   165  	return o
   166  }
   167  
   168  // SetUserID adds the userId to the update user profile params
   169  func (o *UpdateUserProfileParams) SetUserID(userID int64) {
   170  	o.UserID = userID
   171  }
   172  
   173  // WriteToRequest writes these params to a swagger request
   174  func (o *UpdateUserProfileParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   175  
   176  	if err := r.SetTimeout(o.timeout); err != nil {
   177  		return err
   178  	}
   179  	var res []error
   180  
   181  	if o.XRequestID != nil {
   182  
   183  		// header param X-Request-Id
   184  		if err := r.SetHeaderParam("X-Request-Id", *o.XRequestID); err != nil {
   185  			return err
   186  		}
   187  	}
   188  	if o.Profile != nil {
   189  		if err := r.SetBodyParam(o.Profile); err != nil {
   190  			return err
   191  		}
   192  	}
   193  
   194  	// path param user_id
   195  	if err := r.SetPathParam("user_id", swag.FormatInt64(o.UserID)); err != nil {
   196  		return err
   197  	}
   198  
   199  	if len(res) > 0 {
   200  		return errors.CompositeValidationError(res...)
   201  	}
   202  	return nil
   203  }