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

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package projects
     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  // NewAddBranchParams creates a new AddBranchParams 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 NewAddBranchParams() *AddBranchParams {
    26  	return &AddBranchParams{
    27  		timeout: cr.DefaultTimeout,
    28  	}
    29  }
    30  
    31  // NewAddBranchParamsWithTimeout creates a new AddBranchParams object
    32  // with the ability to set a timeout on a request.
    33  func NewAddBranchParamsWithTimeout(timeout time.Duration) *AddBranchParams {
    34  	return &AddBranchParams{
    35  		timeout: timeout,
    36  	}
    37  }
    38  
    39  // NewAddBranchParamsWithContext creates a new AddBranchParams object
    40  // with the ability to set a context for a request.
    41  func NewAddBranchParamsWithContext(ctx context.Context) *AddBranchParams {
    42  	return &AddBranchParams{
    43  		Context: ctx,
    44  	}
    45  }
    46  
    47  // NewAddBranchParamsWithHTTPClient creates a new AddBranchParams object
    48  // with the ability to set a custom HTTPClient for a request.
    49  func NewAddBranchParamsWithHTTPClient(client *http.Client) *AddBranchParams {
    50  	return &AddBranchParams{
    51  		HTTPClient: client,
    52  	}
    53  }
    54  
    55  /* AddBranchParams contains all the parameters to send to the API endpoint
    56     for the add branch operation.
    57  
    58     Typically these are written to a http.Request.
    59  */
    60  type AddBranchParams struct {
    61  
    62  	// Body.
    63  	Body AddBranchBody
    64  
    65  	/* ProjectID.
    66  
    67  	   project ID
    68  
    69  	   Format: uuid
    70  	*/
    71  	ProjectID strfmt.UUID
    72  
    73  	timeout    time.Duration
    74  	Context    context.Context
    75  	HTTPClient *http.Client
    76  }
    77  
    78  // WithDefaults hydrates default values in the add branch params (not the query body).
    79  //
    80  // All values with no default are reset to their zero value.
    81  func (o *AddBranchParams) WithDefaults() *AddBranchParams {
    82  	o.SetDefaults()
    83  	return o
    84  }
    85  
    86  // SetDefaults hydrates default values in the add branch params (not the query body).
    87  //
    88  // All values with no default are reset to their zero value.
    89  func (o *AddBranchParams) SetDefaults() {
    90  	// no default values defined for this parameter
    91  }
    92  
    93  // WithTimeout adds the timeout to the add branch params
    94  func (o *AddBranchParams) WithTimeout(timeout time.Duration) *AddBranchParams {
    95  	o.SetTimeout(timeout)
    96  	return o
    97  }
    98  
    99  // SetTimeout adds the timeout to the add branch params
   100  func (o *AddBranchParams) SetTimeout(timeout time.Duration) {
   101  	o.timeout = timeout
   102  }
   103  
   104  // WithContext adds the context to the add branch params
   105  func (o *AddBranchParams) WithContext(ctx context.Context) *AddBranchParams {
   106  	o.SetContext(ctx)
   107  	return o
   108  }
   109  
   110  // SetContext adds the context to the add branch params
   111  func (o *AddBranchParams) SetContext(ctx context.Context) {
   112  	o.Context = ctx
   113  }
   114  
   115  // WithHTTPClient adds the HTTPClient to the add branch params
   116  func (o *AddBranchParams) WithHTTPClient(client *http.Client) *AddBranchParams {
   117  	o.SetHTTPClient(client)
   118  	return o
   119  }
   120  
   121  // SetHTTPClient adds the HTTPClient to the add branch params
   122  func (o *AddBranchParams) SetHTTPClient(client *http.Client) {
   123  	o.HTTPClient = client
   124  }
   125  
   126  // WithBody adds the body to the add branch params
   127  func (o *AddBranchParams) WithBody(body AddBranchBody) *AddBranchParams {
   128  	o.SetBody(body)
   129  	return o
   130  }
   131  
   132  // SetBody adds the body to the add branch params
   133  func (o *AddBranchParams) SetBody(body AddBranchBody) {
   134  	o.Body = body
   135  }
   136  
   137  // WithProjectID adds the projectID to the add branch params
   138  func (o *AddBranchParams) WithProjectID(projectID strfmt.UUID) *AddBranchParams {
   139  	o.SetProjectID(projectID)
   140  	return o
   141  }
   142  
   143  // SetProjectID adds the projectId to the add branch params
   144  func (o *AddBranchParams) SetProjectID(projectID strfmt.UUID) {
   145  	o.ProjectID = projectID
   146  }
   147  
   148  // WriteToRequest writes these params to a swagger request
   149  func (o *AddBranchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
   150  
   151  	if err := r.SetTimeout(o.timeout); err != nil {
   152  		return err
   153  	}
   154  	var res []error
   155  	if err := r.SetBodyParam(o.Body); err != nil {
   156  		return err
   157  	}
   158  
   159  	// path param projectID
   160  	if err := r.SetPathParam("projectID", o.ProjectID.String()); err != nil {
   161  		return err
   162  	}
   163  
   164  	if len(res) > 0 {
   165  		return errors.CompositeValidationError(res...)
   166  	}
   167  	return nil
   168  }