autogits/bots-common/gitea-generated/client/package_operations/get_package_parameters.go

218 lines
5.2 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package package_operations
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
)
// NewGetPackageParams creates a new GetPackageParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetPackageParams() *GetPackageParams {
return &GetPackageParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetPackageParamsWithTimeout creates a new GetPackageParams object
// with the ability to set a timeout on a request.
func NewGetPackageParamsWithTimeout(timeout time.Duration) *GetPackageParams {
return &GetPackageParams{
timeout: timeout,
}
}
// NewGetPackageParamsWithContext creates a new GetPackageParams object
// with the ability to set a context for a request.
func NewGetPackageParamsWithContext(ctx context.Context) *GetPackageParams {
return &GetPackageParams{
Context: ctx,
}
}
// NewGetPackageParamsWithHTTPClient creates a new GetPackageParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetPackageParamsWithHTTPClient(client *http.Client) *GetPackageParams {
return &GetPackageParams{
HTTPClient: client,
}
}
/*
GetPackageParams contains all the parameters to send to the API endpoint
for the get package operation.
Typically these are written to a http.Request.
*/
type GetPackageParams struct {
/* Name.
name of the package
*/
Name string
/* Owner.
owner of the package
*/
Owner string
/* Type.
type of the package
*/
Type string
/* Version.
version of the package
*/
Version string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetPackageParams) WithDefaults() *GetPackageParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get package params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetPackageParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get package params
func (o *GetPackageParams) WithTimeout(timeout time.Duration) *GetPackageParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get package params
func (o *GetPackageParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get package params
func (o *GetPackageParams) WithContext(ctx context.Context) *GetPackageParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get package params
func (o *GetPackageParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get package params
func (o *GetPackageParams) WithHTTPClient(client *http.Client) *GetPackageParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get package params
func (o *GetPackageParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithName adds the name to the get package params
func (o *GetPackageParams) WithName(name string) *GetPackageParams {
o.SetName(name)
return o
}
// SetName adds the name to the get package params
func (o *GetPackageParams) SetName(name string) {
o.Name = name
}
// WithOwner adds the owner to the get package params
func (o *GetPackageParams) WithOwner(owner string) *GetPackageParams {
o.SetOwner(owner)
return o
}
// SetOwner adds the owner to the get package params
func (o *GetPackageParams) SetOwner(owner string) {
o.Owner = owner
}
// WithType adds the typeVar to the get package params
func (o *GetPackageParams) WithType(typeVar string) *GetPackageParams {
o.SetType(typeVar)
return o
}
// SetType adds the type to the get package params
func (o *GetPackageParams) SetType(typeVar string) {
o.Type = typeVar
}
// WithVersion adds the version to the get package params
func (o *GetPackageParams) WithVersion(version string) *GetPackageParams {
o.SetVersion(version)
return o
}
// SetVersion adds the version to the get package params
func (o *GetPackageParams) SetVersion(version string) {
o.Version = version
}
// WriteToRequest writes these params to a swagger request
func (o *GetPackageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// path param name
if err := r.SetPathParam("name", o.Name); err != nil {
return err
}
// path param owner
if err := r.SetPathParam("owner", o.Owner); err != nil {
return err
}
// path param type
if err := r.SetPathParam("type", o.Type); err != nil {
return err
}
// path param version
if err := r.SetPathParam("version", o.Version); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}