autogits/bots-common/gitea-generated/client/user/user_block_user_parameters.go

186 lines
4.7 KiB
Go
Raw Normal View History

2024-07-07 21:08:41 +02:00
// Code generated by go-swagger; DO NOT EDIT.
package user
// 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"
)
// NewUserBlockUserParams creates a new UserBlockUserParams 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 NewUserBlockUserParams() *UserBlockUserParams {
return &UserBlockUserParams{
timeout: cr.DefaultTimeout,
}
}
// NewUserBlockUserParamsWithTimeout creates a new UserBlockUserParams object
// with the ability to set a timeout on a request.
func NewUserBlockUserParamsWithTimeout(timeout time.Duration) *UserBlockUserParams {
return &UserBlockUserParams{
timeout: timeout,
}
}
// NewUserBlockUserParamsWithContext creates a new UserBlockUserParams object
// with the ability to set a context for a request.
func NewUserBlockUserParamsWithContext(ctx context.Context) *UserBlockUserParams {
return &UserBlockUserParams{
Context: ctx,
}
}
// NewUserBlockUserParamsWithHTTPClient creates a new UserBlockUserParams object
// with the ability to set a custom HTTPClient for a request.
func NewUserBlockUserParamsWithHTTPClient(client *http.Client) *UserBlockUserParams {
return &UserBlockUserParams{
HTTPClient: client,
}
}
/*
UserBlockUserParams contains all the parameters to send to the API endpoint
for the user block user operation.
Typically these are written to a http.Request.
*/
type UserBlockUserParams struct {
/* Note.
optional note for the block
*/
Note *string
/* Username.
user to block
*/
Username string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the user block user params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserBlockUserParams) WithDefaults() *UserBlockUserParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the user block user params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *UserBlockUserParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the user block user params
func (o *UserBlockUserParams) WithTimeout(timeout time.Duration) *UserBlockUserParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the user block user params
func (o *UserBlockUserParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the user block user params
func (o *UserBlockUserParams) WithContext(ctx context.Context) *UserBlockUserParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the user block user params
func (o *UserBlockUserParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the user block user params
func (o *UserBlockUserParams) WithHTTPClient(client *http.Client) *UserBlockUserParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the user block user params
func (o *UserBlockUserParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithNote adds the note to the user block user params
func (o *UserBlockUserParams) WithNote(note *string) *UserBlockUserParams {
o.SetNote(note)
return o
}
// SetNote adds the note to the user block user params
func (o *UserBlockUserParams) SetNote(note *string) {
o.Note = note
}
// WithUsername adds the username to the user block user params
func (o *UserBlockUserParams) WithUsername(username string) *UserBlockUserParams {
o.SetUsername(username)
return o
}
// SetUsername adds the username to the user block user params
func (o *UserBlockUserParams) SetUsername(username string) {
o.Username = username
}
// WriteToRequest writes these params to a swagger request
func (o *UserBlockUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Note != nil {
// query param note
var qrNote string
if o.Note != nil {
qrNote = *o.Note
}
qNote := qrNote
if qNote != "" {
if err := r.SetQueryParam("note", qNote); 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
}