autogits/bots-common/gitea-generated/client/admin/admin_create_public_key_parameters.go
Adam Majer 598ecbbd5a .
2024-07-07 21:12:40 +02:00

173 lines
5.0 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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"
"src.opensuse.org/autogits/common/gitea-generated/models"
)
// NewAdminCreatePublicKeyParams creates a new AdminCreatePublicKeyParams 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 NewAdminCreatePublicKeyParams() *AdminCreatePublicKeyParams {
return &AdminCreatePublicKeyParams{
timeout: cr.DefaultTimeout,
}
}
// NewAdminCreatePublicKeyParamsWithTimeout creates a new AdminCreatePublicKeyParams object
// with the ability to set a timeout on a request.
func NewAdminCreatePublicKeyParamsWithTimeout(timeout time.Duration) *AdminCreatePublicKeyParams {
return &AdminCreatePublicKeyParams{
timeout: timeout,
}
}
// NewAdminCreatePublicKeyParamsWithContext creates a new AdminCreatePublicKeyParams object
// with the ability to set a context for a request.
func NewAdminCreatePublicKeyParamsWithContext(ctx context.Context) *AdminCreatePublicKeyParams {
return &AdminCreatePublicKeyParams{
Context: ctx,
}
}
// NewAdminCreatePublicKeyParamsWithHTTPClient creates a new AdminCreatePublicKeyParams object
// with the ability to set a custom HTTPClient for a request.
func NewAdminCreatePublicKeyParamsWithHTTPClient(client *http.Client) *AdminCreatePublicKeyParams {
return &AdminCreatePublicKeyParams{
HTTPClient: client,
}
}
/*
AdminCreatePublicKeyParams contains all the parameters to send to the API endpoint
for the admin create public key operation.
Typically these are written to a http.Request.
*/
type AdminCreatePublicKeyParams struct {
// Key.
Key *models.CreateKeyOption
/* Username.
username of the user
*/
Username string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the admin create public key params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminCreatePublicKeyParams) WithDefaults() *AdminCreatePublicKeyParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the admin create public key params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminCreatePublicKeyParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the admin create public key params
func (o *AdminCreatePublicKeyParams) WithTimeout(timeout time.Duration) *AdminCreatePublicKeyParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the admin create public key params
func (o *AdminCreatePublicKeyParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the admin create public key params
func (o *AdminCreatePublicKeyParams) WithContext(ctx context.Context) *AdminCreatePublicKeyParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the admin create public key params
func (o *AdminCreatePublicKeyParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the admin create public key params
func (o *AdminCreatePublicKeyParams) WithHTTPClient(client *http.Client) *AdminCreatePublicKeyParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the admin create public key params
func (o *AdminCreatePublicKeyParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithKey adds the key to the admin create public key params
func (o *AdminCreatePublicKeyParams) WithKey(key *models.CreateKeyOption) *AdminCreatePublicKeyParams {
o.SetKey(key)
return o
}
// SetKey adds the key to the admin create public key params
func (o *AdminCreatePublicKeyParams) SetKey(key *models.CreateKeyOption) {
o.Key = key
}
// WithUsername adds the username to the admin create public key params
func (o *AdminCreatePublicKeyParams) WithUsername(username string) *AdminCreatePublicKeyParams {
o.SetUsername(username)
return o
}
// SetUsername adds the username to the admin create public key params
func (o *AdminCreatePublicKeyParams) SetUsername(username string) {
o.Username = username
}
// WriteToRequest writes these params to a swagger request
func (o *AdminCreatePublicKeyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Key != nil {
if err := r.SetBodyParam(o.Key); err != nil {
return err
}
}
// path param username
if err := r.SetPathParam("username", o.Username); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}